Advertisement
Jailout2000

CRC32()

Jul 31st, 2011
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Function CRC32(Data As String) As UInt32
  2.  
  3.   Dim ret As UInt32 = &HFFFFFFFF
  4.   Dim i, j As Integer
  5.  
  6.   Dim CRC32Table As MemoryBlock = InitCRC32()
  7.  
  8.   For i = 1 To LenB(Data)
  9.     j = AscB(MidB(Data, i, 1)) Xor (ret And &HFF)
  10.     If ret < 0 Then ret = ((ret And &H7FFFFFFF) \ &H100) Or &H800000 Else ret = ret \ &H100
  11.     ret = ret Xor CRC32Table.Int32Value(j * 4)
  12.   Next
  13.  
  14.   ret = Not ret
  15.   Return ret
  16.  
  17. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement