Sub docrc8(s As String) As Byte
Dim j As Byte
Dim k As Byte
Dim crc8 As Byte = 0
Dim m As Byte
Dim x As Int
For m = 1 To sf.Len(s)
x = Asc(sf.Mid(s, m, 1))
For k = 0 To 7
j = Bit.AND(1, Bit.Xor(x, crc8))
crc8 = Bit.AND(NumberFormat2((crc8/2),2,0,0,False),0xFF)
x = Bit.AND(NumberFormat2((x/2),2,0,0,False),0xFF)
If j <> 0 Then
crc8 = Bit.Xor(crc8 ,0x8C)
End If
Next
Next
Return crc8
End Sub