没有合适的资源?快使用搜索试试~ 我知道了~
crc16kermit-vb6.0.txt
需积分: 10 93 浏览量
2020-01-11
12:43:25
上传
评论
收藏 2KB TXT 举报
vb6.0下的crc16ccitt(kermit)算法。定义好的函数,可拷入直接使用。本人的程序中的crc16函数,准确可靠。需要的可以下载。保证完整性。多多支持!~!!~
资源推荐
资源详情
资源评论


















'CRC
Public Function ComputeCRC(ByRef inBuf() As Byte, ByVal nStart As Long, ByVal nBytes As Long) As Long
'*****************************************************
' Purpose: Calculates the 16-bit CCITT CRC check of
' a sequence of bytes
' Inputs: inBuf() input array of bytes
' nStart starting point in inBuf
' nBytes number of bytes to use
' Returns: The unsigned 16-bit CRC as a long
' Method: Devised by Andy Lowry, Columbia University
' The magic number &H1081 is derived from
' the CRC-CCITT polynomial x^16+x^12+x^5+1
'*****************************************************
Dim crc As Long 'running CRC value
Dim Q As Long 'intermediate value
Dim c As Long 'byte being used, as a long
Dim i As Long 'loop counter
crc = 0
For i = nStart To nStart + nBytes - 1
c = inBuf(i)
Q = (crc Xor c) And &HF& 'low nibble
crc = (crc \ &H10&) Xor (Q * &H1081&)
Q = (crc Xor (c \ &H10&)) And &HF& 'high nibble
crc = (crc \ &H10&) Xor (Q * &H1081&)
Next i
ComputeCRC = crc
End Function
'6位卡金额变为CRC字符串
Public Function ComputeCRC(ByRef inBuf() As Byte, ByVal nStart As Long, ByVal nBytes As Long) As Long
'*****************************************************
' Purpose: Calculates the 16-bit CCITT CRC check of
' a sequence of bytes
' Inputs: inBuf() input array of bytes
' nStart starting point in inBuf
' nBytes number of bytes to use
' Returns: The unsigned 16-bit CRC as a long
' Method: Devised by Andy Lowry, Columbia University
' The magic number &H1081 is derived from
' the CRC-CCITT polynomial x^16+x^12+x^5+1
'*****************************************************
Dim crc As Long 'running CRC value
Dim Q As Long 'intermediate value
Dim c As Long 'byte being used, as a long
Dim i As Long 'loop counter
crc = 0
For i = nStart To nStart + nBytes - 1
c = inBuf(i)
Q = (crc Xor c) And &HF& 'low nibble
crc = (crc \ &H10&) Xor (Q * &H1081&)
Q = (crc Xor (c \ &H10&)) And &HF& 'high nibble
crc = (crc \ &H10&) Xor (Q * &H1081&)
Next i
ComputeCRC = crc
End Function
'6位卡金额变为CRC字符串
资源评论

qq_41895567
- 粉丝: 0
- 资源: 5

上传资源 快速赚钱
我的内容管理 收起
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助

会员权益专享
安全验证
文档复制为VIP权益,开通VIP直接复制
