Hi this is a little crc check I made for strings comments suggestions welcome.
Example
vbnet Code:
Private Function LittleCrc(ByVal Source As String) As Long Dim Table As Array = {&H417, &H429, &H45F, &H419, &H41B, &H425, &H427, &H42D, &H43F, &H443, &H445, &H449, &H44F, &H455, &H45D, &H463, &H469, &H47F4, &H481, &H48B2, &H4931, &H49D, &H4A3, &H4A9, &H4B1, &H4BD4, &H4C1, &H4C79, &H4CD1, &H4CF, &H4D5, &H4E1, &H545} 'Starting value. Dim crc As Long = &HFFFF For x As Integer = 0 To Source.Length - 1 'Create crc crc = (crc << 1) Xor Table((crc Xor Asc(Source) * Asc(Source(x))) And &H20) Next x 'Return crc Return crc End Function
Example
vbnet Code:
MessageBox.Show(Hex(LittleCrc("Ben Jones")), "LittleCrc", MessageBoxButtons.OK, MessageBoxIcon.Information) 'Ret 1F99B73 MessageBox.Show(Hex(LittleCrc("ben jones")), "LittleCrc", MessageBoxButtons.OK, MessageBoxIcon.Information) 'Ret 1F91E8D