def propagateChangesKeyPositions(): key = 0x2b7e151628aed2a6abf7158809cf4f3c aesv = aes.AES(key) m = 0x1597C4EF331CC28B7E6D1B2EB3EA3B95 c = aesv.encrypt(m) binc = asBinString(c) posChanging = {} for i in range(128): keyi = key ^ (1 << i) aesv = aes.AES(keyi) ci = aesv.encrypt(m) binci = asBinString(ci) pos = 0 for bit in binci: if (bit != binc[pos]): if pos in posChanging: posChanging[pos] += 1 else: posChanging[pos] = 1 pos += 1 width = 0.5 plt.figure(figsize=(10, 12)) plt.ylabel("Frecuency") plt.xlabel("Bins of positions changing") plt.title("Number of propagated bits changed on key bit") plt.bar(posChanging.keys(), posChanging.values(), width, color='g') plt.show()
def begin_Decrypt(): miwen = mi.get() Key = key.get() list2 = AES.AES(Key, miwen, 0) str2 = "".join(list2) Result.delete(1.0, "end") result.delete(1.0, "end") result.insert(1.0, str2)
def begin_Encrypt(): mingwen = ming.get() Key = key.get() list2 = AES.AES(Key, mingwen, 1) str2 = "".join(list2) result.delete(1.0, "end") Result.delete(1.0, "end") Result.insert(1.0, str2)
def fileTranfer(filename, BRSApublickeye, BRSApublickeyn): pattern = r"\.[^.\\/:*?\"<>|\r\n]+$" #step0:打开文件,读取文件内容作为明文 #print "#"*100 #filename=raw_input("输入你的文件名:") result = re.findall(pattern, filename) if result[0] == ".txt": with open("D:\\python\\code\\" + filename, 'r') as f: plainText = ''.join(f.readlines()) elif result[0] == ".jpg": with open("D:\\python\\code\\" + filename, 'rb') as f: plainText = ''.join(f.readlines()) else: with open("D:\\python\\code\\" + filename, 'rb') as f: plainText = ''.join(f.read()) print "打开文件成功=>", #step1:对明文使用MD5算法进行哈希 #print "#" * 100 #myMD5=MD5.MD5(plainText) #myhash=myMD5.encrypt() #print "哈希值是:",myhash myMD5 = hashlib.md5() myMD5.update(plainText) myhash = myMD5.hexdigest() print "生成哈希值成功=>", #step2:对哈希值使用RSA进行数字签名 #print "#" * 100 #print "RSA算法进行数字签名:" #p=int(raw_input("输入私钥p:")) #q=int(raw_input("输入私钥q:")) myRSA = RSA.RSA(myhash, "", p, q, 107, 0) myRSAlength, myDigitalSignature = myRSA.SKencrypt() print "生成数字签名成功=>", #step3:将明文和数字签名的值连接起来,使用AES算法进行对称加密 #print "#" * 100 MplusE = plainText + myDigitalSignature #print "明文和经过数字签名的哈希值连接:\n长度为:",len(MplusE),MplusE #step4:使用AES对称加密算法对明文和哈希值进行加密 #print "#" * 100 #AESkey=raw_input("输入AES密钥:") AESkey = ''.join(random.sample(string.ascii_letters + string.digits, 16)).lower() print "生成随机AESKEY:%s=>" % AESkey, BRSA = RSA.RSA(AESkey, "", 0, 0, BRSApublickeye, BRSApublickeyn) SecretAESkey = BRSA.PKencrypt() myAES = AES.AES(AESkey, MplusE, "") myAESlength, mySecretText = myAES.allEncrypt() finalSecretText = SecretAESkey + mySecretText print "生成最终密文=>" return finalSecretText
def __init__(self, key): self.encrypted_text = '' self.decrypted_text = '' self.key = key key_expansion = AESKeyExpansion(key) key_expansion.RunGen() self.expanded_key = key_expansion.GetExpandedKey() self.AES_encrypter = AES(self.expanded_key)
def fileTranfer(secretText, RSApublickeye, RSApublickeyn): # step1:使用AES算法解密 # print "#" * 100 # secretText=raw_input("输入需要解密的密文:") SecretAESkey = secretText[0:48] BRSA = RSA.RSA("", SecretAESkey, p, q, 107, 0) AESkey = BRSA.SKdecrypt() print "解密得到AESkey:%s=>"%AESkey, # AESkey = raw_input("输入AES密钥") myAES = AES.AES(AESkey, "", secretText[48:]) Mlength, M = myAES.allDecrypt() # step2: 去掉填充0,分离明文和数字签名值 for i in xrange(-1, -17, -1): if M[i] != '0': break M = M[:i + 1] myplainText = M[:len(M) - 64] myDigitalSignature = M[-64::] print "分离明文和数字签名成功=>", # step3:利用RSA算法分析出哈希值 # print "#" * 100 # RSApublickeye=int(raw_input("输入RSA解密的公钥e:")) # RSApublickeyn=int(raw_input("输入RSA解密的公钥n:")) myRSA = RSA.RSA("", myDigitalSignature, 0, 0, RSApublickeye, RSApublickeyn) myhash = myRSA.PKdecrypt() print "RSA解密出hash值=>", # step4:对明文使用MD5算法进行哈希 # print "#" * 100 # myMD5 = MD5.MD5(myplainText) # calhash = myMD5.encrypt() myMD5 = hashlib.md5() myMD5.update(myplainText) # .encode(encoding='utf-8')) calhash = myMD5.hexdigest() print "计算哈希值成功=>", # step5:比较哈希是否相同,相同将明文内容写入文件中 if calhash == myhash: print "hash相同,传输内容未被篡改" pattern = r"\.[^.\\/:*?\"<>|\r\n]+$" filename = raw_input("输入你要保存的文件名:") result = re.findall(pattern, filename) if result[0] == ".txt": with open("/root/code/panice/xbz/" + filename, 'w') as f: f.write(myplainText) elif result[0] == ".jpg": with open("/root/code/panice/xbz/" + filename, 'wb') as f: f.write(myplainText) with open("/root/code/panice/xbz/temp.txt", 'w') as f: f.write(secretText) print "将解密出来的明文和密文分别写进%s和temp.txt文件中,请查看!" % filename else: print "hash不同,文本错误!"
def test__cipher(self): aes = AES(4, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00") inp = strToWordArray("32 43 f6 a8 88 5a 30 8d 31 31 98 a2 e0 37 07 34") key = strToWordArray("2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3c") w = key_expansion(key, 4, 10) cipher = aes._cipher(inp, w) print(cipher) assert cipher.hex() == "3925841d02dc09fbdc118597196a0b32"
def test__decipher(self): aes = AES(4, "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00") cipher = strToWordArrayDense("69c4e0d86a7b0430d8cdb78070b4c55a") key = strToWordArray("00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f") dw = eq_rev_key_expansion(key, 4, 10) msg = aes._decipher(cipher, dw) assert wordArrayToStr(msg) == "00112233445566778899aabbccddeeff"
def test__AES(self): aes = AES(4, "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f") key = "2b 7e 15 16 28 ae d2 a6 ab f7 15 88 09 cf 4f 3c" inp = "32 43 f6 a8 88 5a 30 8d 31 31 98 a2 e0 37 07 34" ciphertext = aes.encrypt(inp, key) deciphered = aes.decrypt(ciphertext, key) assert deciphered == inp # DENSE # 4 bytes key aes = AES(4, "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f") key = "2b7e151628aed2a6abf7158809cf4f3c" inp = "3243f6a8885a308d313198a2e0370734" ciphertext = aes.encrypt(inp, key, "dense") deciphered = aes.decrypt(ciphertext, key, "dense") assert deciphered == inp # 6 bytes key aes = AES(6, "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f") key = "2b7e151628aed2a6abf7158809cf4f3cabf7158809cf4f3c" inp = "3243f6a8885a308d313198a2e0370734" ciphertext = aes.encrypt(inp, key, "dense") deciphered = aes.decrypt(ciphertext, key, "dense") assert deciphered == inp # 8 bytes key aes = AES(8, "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f") key = "2b7e151628aed2a6abf7158809cf4f3c2b7e151628aed2a6abf7158809cf4f3c" inp = "3243f6a8885a308d313198a2e0370734" ciphertext = aes.encrypt(inp, key, "dense") deciphered = aes.decrypt(ciphertext, key, "dense") assert deciphered == inp
def propagateChangesKeyNumBits(): key = 0x2b7e151628aed2a6abf7158809cf4f3c aesv = aes.AES(key) m = 0x1597C4EF331CC28B7E6D1B2EB3EA3B95 c = aesv.encrypt(m) nchanges = [] for i in range(128): keyi = key ^ (1 << i) aesv = aes.AES(keyi) ci = aesv.encrypt(m) nchanges.append(nDiffBits(c, ci)) possibleNumberOfChanges = list(set(nchanges)) fin = [possibleNumberOfChanges.index(i) for i in nchanges] plt.hist(fin, bins=range(len(possibleNumberOfChanges) + 1), align="left") plt.xticks(range(len(possibleNumberOfChanges)), possibleNumberOfChanges) plt.title( "Number of total bits changed on key bit modifications histogram") plt.xlabel("Number of bits changed") plt.ylabel("Frecuency") plt.show()
def encrypt(self, mode): shiftReg = self.IV partEncrypt = AES() for p in self.plain: partEncrypt.set(shiftReg, self.key) partEncrypt.encrypt() partCipher = int(partEncrypt.getCipher()[:2], 16) ^ p if mode == "ENCRYPT": shiftReg = shiftReg[2:] + int_to_hex(partCipher, 2) else: shiftReg = shiftReg[2:] + int_to_hex(p, 2) self.cipher.append(partCipher)
def compareDe_En(text, cipher_key, name_of_test, test_file): d = aes.AES() d.expanded_key = d.key_expansion(cipher_key) d.file = test_file with open(d.file, "w") as f: f.write(name_of_test + "\n") test_encrypted = d.cipher(text) test1_decrypted = d.inv_cipher(test_encrypted.copy()) if np.array_equal(d.initial_state, test1_decrypted): print("Success: " + name_of_test + " passed") else: print("Failure!" + name_of_test) with open(d.file, "a") as f: f.write("\n\n")
def decrypt(filename, key): with open(docs + filename + '.enc', "rb") as file: fileData = file.read() with open(ivs + filename + '.iv.key', "rb") as file: iv = file.read() decrypted = AES.AES(key).decryptCBC(fileData, iv) with open(docs + filename, "wb") as file: file.write(decrypted) os.remove(docs + filename + '.enc') os.remove(ivs + filename + '.iv.key')
def encrypt(filename, key): with open(docs + filename, "rb") as file: fileData = file.read() iv = get_random_bytes(16) result = AES.AES(key).encryptCBC(fileData, iv) with open(ivs + filename + '.iv.key', 'wb') as file: file.write(iv) with open(docs + filename + '.enc', "wb") as file: file.write(result) os.remove(docs + filename)
def reconaize_e(self): if not self.algorithm == "": if self.algorithm == "Des": newa = DES.DES(self.ifkey(), self.data) self.data = newa.encryption() if self.algorithm == "3DES": newa = DES3.DES3(self.ifkey(), self.data) self.data = newa.des3_encrypt() if self.algorithm == "AES": newa = AES.AES(self.ifkey(), self.data) self.data = newa.encrypt() else: return "error" return self.data else: return "error"
def decrypt(self): initVector = deepcopy(self.IV) partDecrypt = AES() for i in range(0, len(self.plain), 16): partPlain = ''.join( [int_to_hex(self.plain[i + j], 2) for j in range(16)]) partDecrypt.set(partPlain, self.key) partDecrypt.decrypt() partCipher = int_to_hex( int(partDecrypt.getCipher(), 16) ^ int(initVector, 16), 32) self.cipher.append(partCipher) initVector = deepcopy(partPlain) print(self.cipher[-1]) paddle = int(self.cipher[-1][-2:], 16) print(paddle) self.cipher[-1] = self.cipher[-1][:-2 * paddle] print(self.cipher[-1])
def propagateChangesMessageNumBits(): aesv = aes.AES(master_key) m = 0x1597C4EF331CC28B7E6D1B2EB3EA3B95 c = aesv.encrypt(m) nchanges = [] for i in range(128): mi = m ^ (1 << i) ci = aesv.encrypt(mi) nchanges.append(nDiffBits(c, ci)) possibleNumberOfChanges = list(set(nchanges)) fin = [possibleNumberOfChanges.index(i) for i in nchanges] plt.hist(fin, bins=range(len(possibleNumberOfChanges) + 1), align="left") plt.xticks(range(len(possibleNumberOfChanges)), possibleNumberOfChanges) plt.title("Number of total bits changed per modification histogram") plt.xlabel("Number of bits changed") plt.ylabel("Frecuency") plt.show()
def encrypt(self): initV = deepcopy(self.IV) #initVector = [int(initV[i:i+2], 16) for i in range(0, 32, 2)] length = len(self.plain) self.plain = list(self.plain) mod = length % 16 if mod == 0: self.plain.extend([16] * 16) length += 16 else: self.plain.extend([16 - mod] * (16 - mod)) length += 16 - mod partEncrypt = AES() for i in range(0, length, 16): initVector = [int(initV[i:i + 2], 16) for i in range(0, 32, 2)] partList = [self.plain[i + j] ^ initVector[j] for j in range(16)] partPlain = ''.join( [int_to_hex(partList[j], 2) for j in range(16)]) partEncrypt.set(partPlain, self.key) partEncrypt.encrypt() self.cipher.append(partEncrypt.getCipher()) initV = deepcopy(partEncrypt.getCipher())
def propagateChangesMessagePositions(): aesv = aes.AES(master_key) m = 0x1597C4EF331CC28B7E6D1B2EB3EA3B95 c = aesv.encrypt(m) binc = asBinString(c) posChanging = {} for i in range(128): mi = m ^ (1 << i) ci = aesv.encrypt(mi) binci = asBinString(ci) pos = 0 for bit in binci: if (bit != binc[pos]): if pos in posChanging: posChanging[pos] += 1 else: posChanging[pos] = 1 pos += 1 width = 0.5 plt.figure(figsize=(10, 12)) plt.ylabel("Frecuency") plt.xlabel("Bins of positions changing") plt.title("Number of propagated bits changed on mesage bit") plt.bar(posChanging.keys(), posChanging.values(), width, color='g')
sync_package = bin_in.readline(16) return key, sync_package def execute(aes: AES, operat: str, msg, iv): if operat == 'encrypt': with open('encrypt.bin', 'wb') as bin_out: cipher_text = aes.encrypt_cfb(msg, iv) bin_out.write(cipher_text) elif operat == 'decrypt': with open('decrypt.bin', 'wb') as bin_out: open_text = aes.decrypt_cfb(msg, iv) bin_out.write(open_text) if __name__ == '__main__': file_name = input('Enter file name with data: ') data = read_data_from_binary_file(file_name) key, iv = read_key_and_iv('key.bin') aes = AES(key) operation = input('What do you want operation to execute?: ') execute(aes, operation, data, iv)
def createCoupleWithRdm(plaintext, key, loc): plaincopy = copy(plaintext) faultedCiph = setFaultRdm(plaincopy, key, loc) realCiph = AES(plaintext, key) return realCiph, faultedCiph
0x6d88a37a, 0x110b3efd, 0xdbf98641, 0xca0093fd, 0x4e54f70e, 0x5f5fc9f3, 0x84a64fb2, 0x4ea6dc4f, 0xead27321, 0xb58dbad2, 0x312bf560, 0x7f8d292f, 0xac7766f3, 0x19fadc21, 0x28d12941, 0x575c006e, 0xd014f9a8, 0xc9ee2589, 0xe13f0cc8, 0xb6630ca6 ] starting_state = np.array(starting_state) state = np.array(starting_state) sub = np.array(sub) shift = np.array(shift) mix = np.array(mix) key = np.array(key) expanded = np.array(expanded) # xtime(57) = ae # xtime(ae) = # ae = 1010 1110 bit shifted becomes 1 0101 1100 c = aes.AES() #c.state = state if c.ffAdd(0x57, 0x83) == 0xd4 and c.xtime(0x57) == 0xae and c.xtime( 0xae) == 0x47 and c.xtime(0x47) == 0x8e and c.xtime(0x8e) == 0x07: print("Success: ffAdd and xtime works!") if c.ffMultiply(0x57, 0x13) == 0xfe: print("Success: ffMult works!") if c.subWord([0x00, 0x10, 0x20, 0x30]) == [0x63, 0xca, 0xb7, 0x04] \ and c.subWord([0x40, 0x50, 0x60, 0x70]) == [0x09, 0x53, 0xd0, 0x51] \ and c.subWord([0x80, 0x90, 0xa0, 0xb0]) == [0xcd, 0x60, 0xe0, 0xe7] \ and c.subWord([0xc0, 0xd0, 0xe0, 0xf0]) == [0xba, 0x70, 0xe1, 0x8c]: print("Success: subWord works!") if np.array_equal(c.rotWord([0x09, 0xcf, 0x4f, 0x3c]), np.array([0xcf, 0x4f, 0x3c, 0x09])) \
import random import read_write as rw import AES if __name__ == '__main__': text = rw.get_text() aes = AES.AES([random.randint(0, 255)] * 16) encrypted_text = '' for i in rw.big_text_to_byte(text): encrypted_text += ''.join(map(chr, aes.encrypt(i))) decrypted_text = '' for i in rw.big_text_to_byte(encrypted_text): decrypted_text += ''.join(map(chr, aes.decrypt(i))) print encrypted_text print '\n=============\n' print decrypted_text
def __main__(): SelectFunc = "Please select the functions\n" SelectEncrypt = "0: Encrypt\n" SelectDecrypt = "1: Decrypt\n" SelectSign = "2: Signature\n" SelectAuth = "3: Authentication\n" SelectOut = "Other: Exit\n" while True: Project = input(SelectFunc+SelectEncrypt+SelectDecrypt+SelectSign+SelectAuth+SelectOut) #Encrypt if Project == "0": SelectAlgo = input("Please select the encrypt algorithm\n"+"0: AES(CRT)\n"+"1: TEA(CRT/CBC)\n"+"Other : RSA(2048bits)\n") #AES if SelectAlgo == "0": AESOJ = AES.AES() KeyFile = input("Please input the key file(file path)\n") AESOJ.GetKey(KeyFile) AESOJ.ExpanKey() CounterFile = input("Please input the counter file(file path)\n") AESOJ.GetCounter(CounterFile) PlainFile = input("Please input the file ready to encrypt\n") AESOJ.GetPlain(PlainFile) AESOJ.Padding() AESOJ.BlockMessage() CipherFile = input("Please input the file to save the ciphertext\n") if AESOJ.Encrypt(CipherFile): print("Encrypt Successful!\n") else: print("Encrypt Fail\n") exit(1) #TEA elif SelectAlgo == "1": TEAOJ = TEA.TEA() Moduel = input("Please select the encrypt moduel\n"+"0: CRT\n"+"1: CBC\n") TEAOJ.SelectModule(Moduel) TEAKey = input("Please input the key file(file path)\n") TEAOJ.ReadKey(TEAKey) PlainFile = input("Please input the file ready to encrypt\n") TEAOJ.ReadFile(PlainFile) CipherFile = input("Please input the file to save the ciphertext\n") if Moduel=="0": CounterFile = input("please input the initial counter file\n") TEAOJ.ReadCount(CounterFile) if TEAOJ.TEACryptCounter(CipherFile): print("Encrypt Successful!\n") else: print("Encrypt Fail\n") exit(1) elif Moduel=="1": CBCVIFile = input("Please input the initial CBC VI file\n") TEAOJ.ReadVI(CBCVIFile) if TEAOJ.TEACryptCBC(CipherFile): print("Encrypt Successful!\n") else: print("Encrypt Fail\n") exit(1) else: exit(1) #RSA else: RSAOJ=RSA.RSA() Pukey = input("Please input the public key(file path)\n") RSAOJ.GetPrKey(Pukey) PlainFile = input("Please input the file ready to encrypt\n") RSAOJ.GetPlain(PlainFile) RSAOJ.BlockMessage(128) CipherFile = input("Please input the file to save the ciphertext\n") if RSAOJ.Encrypt(CipherFile): print("Encrypt Successful!\n") else: print("Encrypt Fail\n") exit(1) continue #Decrypt elif Project == "1": SelectAlgo = input("Please select the decrypt algorithm\n" + "0: AES(CRT)\n" + "1: TEA(CRT/CBC)\n" + "Other : RSA(2048bits)\n") # AES if SelectAlgo == "0": AESOJ = AES.AES() KeyFile = input("Please input the key file(file path)\n") AESOJ.GetKey(KeyFile) AESOJ.ExpanKey() CounterFile = input("Please input the counter file(file path)\n") AESOJ.GetCounter(CounterFile) CipherFile = input("Please input the file ready to decrypt\n") AESOJ.GetPlain(CipherFile) AESOJ.BlockMessage() PlainFile = input("Please input the file to save the plaintext\n") if AESOJ.Encrypt(PlainFile): print("Decrypt Successful!\n") else: print("Decrypt Fail\n") exit(1) # TEA elif SelectAlgo == "1": TEAOJ = TEA.TEA() Moduel = input("Please select the decrypt moduel\n" + "0: CRT\n" + "1: CBC\n") TEAOJ.SelectModule(Moduel) TEAKey = input("Please input the key file(file path)\n") TEAOJ.ReadKey(TEAKey) CipherFile = input("Please input the file ready to decrypt\n") TEAOJ.ReadFile(CipherFile) PlainFile = input("Please input the file to save the plaintext\n") if Moduel == "0": CounterFile = input("please input the initial counter file\n") TEAOJ.ReadCount(CounterFile) if TEAOJ.TEADecryCounter(PlainFile): print("Decrypt Successful!\n") else: print("Decrypt Fail\n") exit(1) elif Moduel == "1": CBCVIFile = input("Please input the initial CBC VI file\n") TEAOJ.ReadVI(CBCVIFile) if TEAOJ.TEADecryCBC(PlainFile): print("Decrypt Successful!\n") else: print("Decrypt Fail\n") exit(1) else: exit(1) # RSA else: RSAOJ = RSA.RSA() Prkey = input("Please input the private key(file path)\n") RSAOJ.GetPuKey(Prkey) CipherFile = input("Please input the file ready to decrypt\n") RSAOJ.GetPlain(CipherFile) RSAOJ.BlockMessage(256) PlainFile = input("Please input the file to save the plaintext\n") if RSAOJ.Decrypt(PlainFile): print("Decrypt Successful!\n") else: print("Encrypt Fail\n") exit(1) continue #Signatrue elif Project == "2": RSAOJ=RSA() Prkey = input("Please input the private key(file path)\n") RSAOJ.GetPrKey(Prkey) PlainFile = input("Please input the file ready to Signature\n") SaveFile = input("Please input the file to save the Signatrue\n") if RSAOJ.SignNature(PlainFile,SaveFile): print("Signatrue Successful!\n") else: print("Signatrue Fail!\n") exit(1) continue #Authentication elif Project == "3": RSAOJ = RSA() Pukey = input("Please input the public key(file path)\n") RSAOJ.GetPuKey(Prkey) SignFile = input("Please input the Signature File\n") MessageFile = input("Please input the Message file\n") if RSAOJ.Auth(SignFile,MessageFile): print("Authentication Successfully!\n") else: print("Authentication Fail!\n") exit(1) continue #exit else: break
import AES if __name__ == "__main__": key = 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f round = 14 bits = 256 msg = "75e651b3e55456a8e56e643c06371d2075e651b3e55456a8e56e643c06371" ciph = "0c9af0650e41603a4995979a0241e70d901e01540d3c714216c58f5685ecc000" cryptor = AES.AES(key, round, bits) for i in cryptor.encrypt(msg): print(hex(i)) for i in cryptor.decrypt(ciph): print(hex(i))
import os from AES import * key1 = '264E62702662713A7E7D706D777E762E45555A40412934387A606A28402A4B37' key2 = '264E62702662713A7E7D706D777E762E45555A40412934387A606A28402A4B37' IV = os.stat('testfile.txt').st_ino key = (key1, key2) plaintext = open('testfile.txt').read() cipher = AES(key, MODE_XTS, IV) ciphertext = cipher.encrypt(plaintext) print(ciphertext.encode('hex')) decipher = AES(key, MODE_XTS, IV) deciphertext = decipher.decrypt(ciphertext) print(deciphertext)