Skip to content

Commit

Permalink
Merge pull request jarun#481 from zmwangx/crypto-fix
Browse files Browse the repository at this point in the history
Fix BukuCrypt.encrypt_file
  • Loading branch information
jarun authored Nov 22, 2020
2 parents 5d5b680 + 58c2ae2 commit 3d1d75b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions buku
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 3d1d75b

Please sign in to comment.