Public Sub PolyCrc32(buff() as byte, len as int) As Int
Dim Crc As Int = 0
For i=0 To len-1
Crc=Bit.Xor(Crc,buff(i))
For J=0 To 7
' Bit.shiftRight will add a '1' bit to the highest position if the number already has it.
If Bit.And(Crc,1)<>0 Then Crc=Bit.Xor( Bit.And(Bit.ShiftRight(Crc,1), 0x7FFFFFFF) ,0xEDB88320)
Else
Crc=Bit.ShiftRight(Crc,1)
End If
Next
Next
Return crc
End Sub