Fix password encryption with non-alpha passwords. Fixes #1371

This commit is contained in:
Murtuza Zabuawala 2016-06-16 20:32:57 +01:00 committed by Dave Page
parent 5f3511ce39
commit c702ef9c48

View File

@ -48,9 +48,8 @@ def decrypt(ciphertext, key):
iv = ciphertext[:AES.block_size] iv = ciphertext[:AES.block_size]
cipher = AES.new(pad(key), AES.MODE_CFB, iv) cipher = AES.new(pad(key), AES.MODE_CFB, iv)
decrypted = cipher.decrypt(ciphertext[AES.block_size:]) decrypted = cipher.decrypt(ciphertext[AES.block_size:])
l = decrypted.count(padding_string)
return decrypted[:len(decrypted)-l] return decrypted
def pad(str): def pad(str):