AES CBC1 [Python] AES 예제 import base64 from Crypto.Cipher import AES from Crypto import Random pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) unpad = lambda s : s[:-ord(s[len(s)-1:])] class AESCipher: def __init__( self, key ): self.key = key def encrypt( self, raw ): raw = pad(raw) iv = Random.new().read( AES.block_size ) cipher = AES.new( self.key, AES.MODE_CBC, iv ) return base64.b64encode( iv + ciphe.. 2018. 2. 6. 이전 1 다음 반응형