首页 > 代码库 > AES(高级加密)

AES(高级加密)

AES(高级加密)

3.6安装  pip3 install pycryptodome

a. 事例:

############################### 加密 ##############################

	from Crypto.Cipher import AES
	def encrypt(message):
	    key = b‘dfdsdfsasdfdsdfs‘						#key必须是16的整数倍
	    cipher = AES.new(key, AES.MODE_CBC, key)		#创建对象
	    ----------------------------------------------
	    #先转成字节,把数据拼够16字节的整数倍
	    ba_data = http://www.mamicode.com/bytearray(message,encoding=‘utf-8‘)	#把数据转成bytearray(byte的数组),bytearray只能追加数字,默认把数字转成字节>

  

wuSir  

AES(高级加密)