Encrypting a short string?

Paul Rubin http
Mon Feb 11 15:24:21 EST 2008


erikcw <erikwickstrom at gmail.com> writes:
> database.  I'm using this encrypted string to identify emails from a
> user. (the string will be in the subject line of the email).

1. I hope you're not trying to spam anyone.
2. What happens if the user edits the subject line?

> I'm trying to figure out which approach I should use to encrypt the
> data.  The string will be less than 20 characters long, and I'd like
> the encrypted version to be about the same size.

Under normal security requirements you cannot do this.  The ciphertext
has to be longer than the plaintext since you don't want the opponent
to be able to tell whether two plaintexts are the same.  Therefore you
have to attach some random padding to each plaintext.  Also, you
presumably want the ciphertext to be encoded as printing characters,
while normally you'd treat the input as binary, so there is some
further expansion.



More information about the Python-list mailing list