Skip to content

Commit 19323a0

Browse files
author
Ong Yong Xin
authored
Fix crypt.py
Previously, when decrypting a file, args.key was passed in as a string to aes_decrypt() (when it should be a bytes object), resulting in the decryption failing. Also, there is no longer any “b''“ around the key output from encrypting a file. (Tested on Python 2.7 also)
1 parent 5491153 commit 19323a0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/crypt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def aes_decrypt(self, key, chunksize=64 * 1024):
7474
args = ap.parse_args()
7575
crypt = Crypt(args.infile, args.outfile)
7676
if args.decrypt:
77-
crypt.aes_decrypt(args.key)
77+
crypt.aes_decrypt(args.key.encode())
7878
else:
7979
nk = crypt.aes_encrypt(args.key)
8080
if args.key is None:
81-
print("Key: %s" % nk)
81+
print("Key: %s" % nk.decode())

0 commit comments

Comments
 (0)