Ask for advice on python2.7 encryption algorithm

has a string of hundreds of kb . Now you want to encrypt this string and decrypt it to the original string by .

encryption requirements:
can compress the hundreds of kb strings into several kb or even several b
can decrypt as the original string

ask whether there are ready-made modules in thigh recommendation 2.7

Mar.10,2021

there are two built-in modules available, zlib and bz2, but they may not be able to achieve the compression ratio you require. You need to verify it. The usage is very simple, so:

import zlib
import bz2
content = "test input string"
print len(zlib.compress(content))
print len(bz2.compress(content))

if you still want to encrypt, you can use the third-party library PyCrypto,. If you don't want to use a third-party library, there seems to be no good built-in encryption algorithm. You can use XOR to do the simplest encryption and decryption by yourself. Generally speaking, the encryption algorithm will not be compressed, so you need encryption and compression algorithms together. If only unreadable plaintext is needed, compression is fine, and there is no need for encryption.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9ca3d-46635.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9ca3d-46635.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?