defcalculate_crc16(self)->str:# 将数据转换为字节流data_bytes=self.data.encode('utf-8')# 使用binascii库计算CRC16crc=binascii.crc_hqx(data_bytes,0)# 将CRC16值转换为十六进制字符串crc_hex=hex(crc)[2:].upper()# 在结果字符串前面补0,使其长度为4crc_hex=crc_hex.zfill(4)returncrc_hex ...
data是要进行转换的二进制数据,返回一个字符串。 binascii.crc_hqx(data, crc=0):计算给定数据的循环冗余校验 (CRC-16) 值。data是要计算CRC的二进制数据,crc是可选的初始CRC值,默认为0。返回一个16位无符号整数表示的CRC值。 binascii.rlecode_hqx(data):对二进制数据进行Run Length Encoding (RLE) 编码...
binascii.rlecode_hqx(data) 在data 上执行 binhex4 游程编码压缩并返回结果。 binascii.b2a_hqx(data) 执行hexbin4 类型二进制到 ASCII 码的转换并返回结果字符串。输入数据应经过 RLE 编码,且数据长度可被3整除(除了最后一个片段)。 binascii.crc_hqx(data, value) 以value 作为初始 CRC 计算 data 的16...
binascii.b2a_qp(data[, quotetabs, istext, header]) binascii.a2b_hqx(string) binascii.rledecode_hqx(data) binascii.rlecode_hqx(data) binascii.b2a_hqx(data) binascii.crc_hqx(data, crc) binascii.crc32(data[, crc]) binascii.b2a_hex(data) binascii.b2a_hex(data) binascii.hexlify(data)...
a2b_hqx(string) binascii.rledecode_hqx(data) binascii.rlecode_hqx(data) binascii.b2a_hqx(data) binascii.crc_hqx(data, crc) binascii.crc32(data[, crc]) binascii.b2a_hex(data) binascii.b2a_hex(data) binascii.hexlify(data) binascii.a2b_hex(hexstr) binascii.unhexlify(hexstr) 异常有:...
binascii.a2b_hqx(string) binascii.rledecode_hqx(data) binascii.rlecode_hqx(data) binascii.b2a_hqx(data) binascii.crc_hqx(data, crc) binascii.crc32(data[, crc]) binascii.b2a_hex(data) binascii.b2a_hex(data) binascii.hexlify(data) ...
Binhex用于Macintosh平台。这里暂不做介绍。相关函数有:binascii.rledecode_hqx(data) ,binascii.rlecode_hqx(data),binascii.a2b_hqx(data),binascii.b2a_hqx(data) ,binascii.crc_hqx(data, crc)。 Base64编码 binascii.a2b_base64(string):转换的base64数据块为二进制,并返回二进制数据。一次可以传递多行...
- bpo-23728: binascii.crc_hqx() could return an integer outside of the range 0-0xffff for empty data. - bpo-23887: urllib.error.HTTPError now has a proper repr() representation. Patch by Berker Peksag. - asyncio: New event loop APIs: set_task_factory() and get_task_factory(). ...
binascii.crc_hqx(data, crc) 计算的一个16位的CRC值的数据,开始以初始CRC并返回结果。这使用CRC-CCITT多项式_x_16 + _x_12 + _x_5 + 1,通常表示为0x1021。该CRC以binhex4格式使用。 binascii.crc32(data[, crc]) 计算数据的32位校验和CRC-32,从最初的crc开始。这与ZIP文件校验和一致。由于该算法...
The binascii.crc_hqx() function remains available. (Contributed by Victor Stinner in bpo-45085.) The distutils bdist_msi command, deprecated in Python 3.9, is now removed. Use bdist_wheel (wheel packages) instead. (Contributed by Hugo van Kemenade in bpo-45124.) Due to significant security...