summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2017-03-09 16:14:11 +0100
committerAndreas Schneider <asn@cryptomilk.org>2017-03-09 16:14:11 +0100
commit3d6f6427bc48c9d58792bccb58d19b0d20de6bee (patch)
tree53ffb52c9e703cfcd1c99c614dc127e22560fc21
parenta57502cedfd76f552deffdaad525a93f85d95e83 (diff)
downloadcpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.tar.gz
cpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.tar.xz
cpaste-3d6f6427bc48c9d58792bccb58d19b0d20de6bee.zip
Compress plaintext
-rwxr-xr-xcpaste6
1 files changed, 2 insertions, 4 deletions
diff --git a/cpaste b/cpaste
index 081ca34..0d2efbd 100755
--- a/cpaste
+++ b/cpaste
@@ -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()