Esempio n. 1
0
 def aes_encrypt(self, message, passphrase):
     iv = '\x00' * 16
     aes = AESModeOfOperationCBC(passphrase, iv=iv)
     return aes.encrypt(message)
Esempio n. 2
0
def aes_cbc_encrypt(data, key, enc_iv):
    cipher = AESModeOfOperationCBC(key, iv=enc_iv)
    return cipher.encrypt(data)
Esempio n. 3
0
def aes_cbc_encrypt(data, key, enc_iv):
    cipher = AESModeOfOperationCBC(key, iv=enc_iv)
    return b"".join([
        cipher.encrypt(data[i:i + AES_BLOCK_SIZE])
        for i in range(0, len(data), AES_BLOCK_SIZE)
    ])
Esempio n. 4
0
def aes_cbc_encrypt(data, key, enc_iv):
    cipher = AESModeOfOperationCBC(key, iv=enc_iv)
    return b"".join([cipher.encrypt(data[i:i + AES_BLOCK_SIZE]) for i in range(0, len(data), AES_BLOCK_SIZE)])