diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2017-03-09 16:14:11 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2017-03-09 16:14:11 +0100 |
commit | 3d6f6427bc48c9d58792bccb58d19b0d20de6bee (patch) | |
tree | 53ffb52c9e703cfcd1c99c614dc127e22560fc21 | |
parent | a57502cedfd76f552deffdaad525a93f85d95e83 (diff) | |
download | cpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.tar.gz cpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.tar.xz cpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.zip |
Compress plaintext
-rwxr-xr-x | cpaste | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -84,10 +84,8 @@ def sjcl_encrypt(plaintext, passphrase): encryptor = cipher.encryptor() encryptor.authenticate_additional_data(bytes(associated_data, 'utf-8')) - # zlib decompress in privatebin doesn't work - #compressed_blob = base64.b64encode(zlib.compress(bytes(plaintext, 'utf-8'), 0)) - #compressed_blob = base64.b64encode(bytes(plaintext, 'utf-8')) - compressed_blob = bytes(plaintext, 'utf-8') + # compress plaintext with zlib + compressed_blob = base64.b64encode(zlib.compress(plaintext.encode('utf-8'))) cipher_text = encryptor.update(compressed_blob) + encryptor.finalize() |