Re: occasional mcrypt problems
| From: | Steve Yates | Date: | Tue, 14 Jan 2003 05:38:35 +0000 |
| Subject: | Re: occasional mcrypt problems | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-131517@lists.php.net to get a copy of this message | ||
"J Smith" <dark_panda@hushmail.com> wrote in message
news:20030113175038.42790.qmail@pb1.pair.com...
> Try using a different block cipher mode. When encrypting with ECB, as you
> said, your plaintext must have a length that is a multiple of the
blocksize
Are you sure? I read the manual the other way...that the *result* is a
multiple of blocksize:
"This function encrypts data. The data is padded with "\0" to make sure the
length of the data is n * blocksize. This function returns the encrypted
data. Note that the length of the returned string can in fact be longer then
the input, due to the padding of the data."
I am storing the encrypted, padded string.
> If it's anything less, you're going to get some garbage at
> the end of the decrypted ciphertext.
This would imply that any non-blocksize-length strings would be
corrupted which is not the case. 99% are fine.
> require that you store the IV for each encryption along with the
> ciphertext, but that's fine, as storing the IV along with the ciphertext
is
> not a security problem.
However changing now will mean handling some historical data differently
somehow. :( And storing an IV for each record would of course increase the
data size.
- Steve Yates
- #include <mandatory_cute_tagline>
~ Taglines by Taglinator - www.srtware.com ~