Merge pull request #481 from zmwangx/crypto-fix

Fix BukuCrypt.encrypt_file
This commit is contained in:
Mischievous Meerkat 2020-11-22 20:55:15 +05:30 committed by GitHub
commit 3d1d75b13b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

6
buku
View File

@ -226,9 +226,11 @@ class BukuCrypt:
if len(chunk) == 0:
break
if len(chunk) % 16 != 0:
chunk = '%s%s' % (chunk, ' ' * (16 - len(chunk) % 16))
chunk = b'%b%b' % (chunk, b' ' * (16 - len(chunk) % 16))
outfp.write(encryptor.update(chunk) + encryptor.finalize())
outfp.write(encryptor.update(chunk))
outfp.write(encryptor.finalize())
os.remove(dbfile)
print('File encrypted')