# from itertools import product
from Crypto.Hash import CMAC
from Crypto.Cipher import AES
from binascii import hexlify, unhexlify
# secret = b'55555555555555555555555555555555'
# print(secret)
# cobj = CMAC.new(secret, ciphermod=AES)
# result=cobj.update(b'037278FF0280020EBE')
# print(result)
# print (cobj.hexdigest())
#secret= unhexlify('2b7e151628aed2a6abf7158809cf4f3c')
secret= unhexlify('31313232333334343535363637373838')
message = unhexlify('31323334353637383132333435363738')
c = CMAC.new(secret,message,ciphermod=AES)
print( c.hexdigest())
这篇博客展示了如何使用Python的`Crypto`库进行CMAC(Cipher-based Message Authentication Code)和AES(Advanced Encryption Standard)加密。通过示例代码,解释了如何初始化CMAC对象,更新消息并获取加密哈希值。内容涉及到信息安全和加解密技术。
1347

被折叠的 条评论
为什么被折叠?



