zl程序教程

您现在的位置是:首页 >  Python

当前栏目

基于Python 的AES CMAC

2023-03-20 15:00:03 时间

# 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())