first_param="{rid:\"\",offset:\"0\",total:\"true\",limit:\"20\",csrf_token:\"\"}"defget_params():iv="0102030405060708"first_key=forth_paramsecond_key=16*'F'h_encText=AES_encrypt(first_param,first_key,iv)h_encText=AES_encrypt(h_encText,second_key,iv)returnh_encTextdefAES_encrypt(text,key,iv):pad=16-len(text)%16text=text+pad*chr(pad)encryptor=AES.new(key,AES.MODE_CBC,iv)encrypt_text=encryptor.encrypt(text)encrypt_text=base64.b64encode(encrypt_text)returnencrypt_text這段代碼第十一行用python就會(huì)拋出can'tconcatstrtobytes無法拼接str,試過轉(zhuǎn)換bytes和轉(zhuǎn)換str再合并都不行。。請(qǐng)教下有沒有什么解決辦法
新手遇阻:python3使用AES加密,參數(shù)can't concat str to bytes
猛跑小豬
2019-05-24 10:12:56