this is AAES256 algo how to change its code to print the encryptoin in > {0xe8, 0x45} form I want result in this {0x38, 0x67} form
BLOCK_SIZE = 16
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * chr(BLOCK_SIZE - len(s) % BLOCK_SIZE)
unpad = lambda s: s[:-ord(s[len(s) - 1:])]
password = input("hihellolistenbbcnews")
def get_private_key(password):
salt = b"this is a salt"
kdf = PBKDF2(password, salt, 64, 1000)
key = kdf[:32]
return key
def encrypt(raw, password):
private_key = get_private_key(password)
raw = pad(raw)
iv = Random.new().read(AES.block_size)
cipher = AES.new(private_key, AES.MODE_CBC, iv)
return base64.b64encode(iv + cipher.encrypt(raw))
def decrypt(enc, password):
private_key = get_private_key(password)
enc = base64.b64decode(enc)
iv = enc[:16]
cipher = AES.new(private_key, AES.MODE_CBC, iv)
return unpad(cipher.decrypt(enc[16:]))
encrypted = encrypt("This is a secret message", password)
open("favicon.ico", "wb").write(encrypted)
print(encrypted)