The following code computes a hash value for a byte array and returns it as an Int32. This can be faster or more useful than MD5, depending on your needs.
Shared Function ComputeInt32XORHash(ByVal Seed As Int32, _
ByVal Buffer() As Byte, ByVal Index As Integer, _
ByVal Length As Integer) As Int32
Dim HashCode As Int32 = Seed
While Index <= Length - 4
HashCode = HashCode Xor BitConverter.ToInt32(Buffer, Index)
Index += 4
End While
If Index < Length Then
Dim Offset As Integer = 0
Dim LastBlock(3) As Byte
For Offset = 0 To Length - Index - 1
LastBlock(Offset) = Buffer(Index + Offset)
Next
HashCode = HashCode Xor BitConverter.ToInt32(LastBlock, 0)
End If
Return HashCode
End Function
Converts a date formated as YYYYMMDD to a MM/DD/YYYY format
Public Function GetFormattedDate(ByVal s8CharDate As String) As String
Dim sMonth, sDay, sYear As String
If (IsDBNull(s8CharDate) = True) Then Return ""
If (IsNothing(s8CharDate)) Then Return ""
If (s8CharDate.Length >= 8) Then
If (s8CharDate.Substring(4, 2) < 10) Then : sMonth = s8CharDate.Substring(5, 1)
Else : sMonth = s8CharDate.Substring(4, 2) : End If
If (s8CharDate.Substring(6, 2) < 10) Then : sDay = s8CharDate.Substring(7, 1)
Else : sDay = s8CharDate.Substring(6, 2) : End If
Return sMonth & "/" & sDay & "/" & s8CharDate.Substring(0, 4)
End If
Return ""
End Function