-1
I need to encrypt some database keys to decrypt in the future, but all generated messages need to be the same size. md5 has generated messages of the same size, but can not translate back (E is not encryption, but message Digest). I tried to use simple-decrypt
, but the generated messages are of different sizes:
import sys
from simplecrypt import encrypt, decrypt
from base64 import b64encode, b64decode
from getpass import getpass
password = getpass()
message = sys.argv[1]
cipher = encrypt(password, message)
encoded_cipher = b64encode(cipher)
print(encoded_cipher)
I wanted to know if it is possible to limit the message size. Or create a crypt method that limits the size of the generated message.
Is that what you want to know? -> https://crypto.stackexchange.com/a/29989
– hkotsubo
Not really, my encoded_cipher I hope is already bigger than the id, but I always want a fixed size. Maximum id size type will always be 8, and the size of my encoded_cipher will always be 20, regardless of whether the id is 1 or 12345678
– Vinicius Morais
But reading the guy’s answer, I understood some things I need.
– Vinicius Morais