Re: Encryption failing
| From: | Zoltán Németh | Date: | Fri, 18 Jan 2008 08:34:07 +0000 |
| Subject: | Re: Encryption failing | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267531@lists.php.net to get a copy of this message | ||
2008. 01. 17, csütörtök keltezéssel 12.14-kor Ken Kixmoeller -- reply to
ken@kixmoeller.com ezt írta:
> (forgot to copy the list)
>
> On Jan 16, 2008, at 5:08 PM, Richard Lynch wrote:
>
>
> > Is it possible that 4% of the time, you have spaces on the start/end
> > of the string, which get trimmed before encryption?
> >
>
> In this case, no. In trying to simplify the situation to narrow the
> possibilities of error, I am generating "random" character strings of
> only alphanumeric (or numeric-only) characters. Each is exactly 16
> characters.
>
>
>
> > And if rijndael is one of the algorithms which requires a fixed-size
> > input, that also would be "bad" to trim it.
> >
>
> No documentation that I was able to find suggests that requirement.
>
>
>
>
> > Actually, I'd suggest that the encryption function has no business
> > trimming the text anyway.
> >
>
> Philosophically I agree with you, but mCrypt has this nasty habit of
> appending bunches of nulls to the decrypted string. So philosophical
> purity gives way to practical application.
yeah, I just ran into the same thing yesterday evening with mcrypt and
rijndael_256.
encrypting went fine, decrypted string had a lot of nulls at the end. so
I too had to use trim() on it.
greets
Zoltán Németh
>
> Good ideas, as usual. Thank you.
>
> Ken
>
>