-
-
Save anonymous/d24a7a03f7f2a771c0f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function CRC16HASH(txt) | |
Dim x As Long | |
Dim mask, i, j, nC, crc As Integer | |
Dim c As String | |
crc = &HFFFF | |
For nC = 1 To Len(txt) | |
j = asc(Mid(txt, nC, 1)) | |
crc = crc Xor j | |
For j = 1 To 8 | |
mask = 0 | |
If crc / 2 <> Int(crc / 2) Then mask = &HA001 | |
crc = Int(crc / 2) And &H7FFF: crc = crc Xor mask | |
Next j | |
Next nC | |
CRC16HASH = Hex$(crc) | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Thanks for uploading this, very helpful.
I'm trying to verify the result from your function using the CRC calculator at http://www.zorc.breitbandkatze.de/crc.html
I'm unable to work out what the initial value and CRC polynomial values used in your code are. Could you please tell me how I can verify the resulting hash?