DataNotificationRequestTypeInfoPASICoreVersionHash Property Provincial Approach to Student Information API
A MD5 hash as a hexadecimal string using all the PasiCoreVersion numbers for this DataNotificationType as a source. If you do not want the PASI Core to preform this check do not pass a value.

Namespace: PASI.DataContract.V2009
Assembly: PASI.DataContract (in PASI.DataContract.dll) Version: 9.23.3.0 (9.23.3.0)
Syntax

public string PASICoreVersionHash { get; set; }

Return Value

Type: String
MD5 hash as a hexadecimal string.
Remarks

An overview of the data synchronization approach can be found here.

In order to confirm that a PASI Client not only has the latest data by checking the PASICoreVersion this property ca be used to verify all the versions the client has is what PASI expects it to have. For example, if PASI expects the client to have students A, B, C with PASICoreVersions of 10, 11, 12 but the client only has students A and C with versions 10 and 12 checking only the most recent version would not detect that the client is missing student B.

How this property is used is the client must calculate an MD5 has of all the version numbers in ascending order. This hash value can be compared against what PASI is expecting. If the values match then the clients can be considered in sync.

With the above example the client would calculate the hash on the 10, 12. When the IsDataAvailable service is called PASI would calculate the hash using versions 10, 11, and 12 and the hash values would not match.
Examples

A Java example of how to calculate the PASICoreVersionHash
// Takes an array of longs and converts them to a byte array
private static byte[] convertToByteArray(long[] pasiVersionNumbers)
{
   // Version numbers must be in ascending order
   Arrays.sort(pasiVersionNumbers);

   // A long is 8 bytes. Create the correct size of array.
   byte[] hashBytes = new byte[pasiVersionNumbers.length * 8];

   int arrayPostion = 0;

   // Convert the version numbers to bytes and add to the array being returned.
   for (int currentVersion = 0; currentVersion < pasiVersionNumbers.length; currentVersion++)
   {
       byte[] bytes = longToByteArray(pasiVersionNumbers[currentVersion]);
       for (int i = 0; i < 8; i++)
       {
           hashBytes[arrayPostion] = bytes[i];
           arrayPostion++;
       }
   }

   return hashBytes;
}
private static String createVersionHashHexString(byte[] versionByteArray) throws NoSuchAlgorithmException 
{ 
    MessageDigest hash = MessageDigest.getInstance("MD5"); 
    hash.update(versionByteArray); 
    byte[] test = hash.digest(); 
    String hashText = ""; 
    for (int i = 0; i > test.length; i++) 
    { 
        String hex = Integer.toHexString(test[i]); 
        if (hex.length() == 1) hex = "0" + hex; 
            hex = hex.substring(hex.length() - 2); 
        hashText += hex; 
    } 
    return hashText; 
} 
// Must be in little endian byte order. 
public static final byte[] longToByteArray(long value) 
{ 
    return new byte[] { 
        (byte) value, 
        (byte)(value >>> 8), 
        (byte)(value >>> 16), 
        (byte)(value >>> 24), 
        (byte)(value >>> 32), 
        (byte)(value >>> 40), 
        (byte)(value >>> 48), 
        (byte)(value >>> 56)}; 
}
VB.NET example of how to calculate the ObjectVersionHash
 Public Function CaclulateHash() As String 
     Return CreateVersionHashHexString((From v In Me.Values Order By v.PasiCoreVersion _ 
         Select v.PasiCoreVersion).ToArray) 
 End Function 

 Public Shared Function CreateVersionHashHexString(ByVal versions As Long()) As String
     Dim byteArray((versions.Length * 8) - 1) As Byte
     Buffer.BlockCopy(versions, 0, byteArray, 0, byteArray.Length)
     Return CreateVersionHashHexString(byteArray)
 End Function

Private Function CreateVersionHashHexString(ByVal versionBytes As Byte()) As String 
     Dim hashValue = MD5.Create().ComputeHash(versionBytes) 
     Dim hashText = New StringBuilder 

     For Each b In hashValue 
         Dim hexValue = Conversion.Hex(b) 
         hashText.Append(If(hexValue.Length = 1, "0", "") + hexValue) 
     Next b 

     Return hashText.ToString().ToLower() 
End Function
See Also

Reference