Re: [PHP] Encryption failing

2008-01-18 Thread Zoltán Németh
2008. 01. 17, csütörtök keltezéssel 12.14-kor Ken Kixmoeller -- reply to [EMAIL PROTECTED] 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

Re: [PHP] Encryption failing

2008-01-17 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
(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,

Re: [PHP] Encryption failing

2008-01-16 Thread Richard Lynch
Is it possible that 4% of the time, you have spaces on the start/end of the string, which get trimmed before encryption? And if rijndael is one of the algorithms which requires a fixed-size input, that also would be "bad" to trim it. If you need multiple of 16 bytes input, leave the input alone.

Re: [PHP] Encryption failing

2008-01-16 Thread Richard Lynch
On Tue, January 15, 2008 10:48 pm, Casey wrote: > On Jan 15, 2008 8:40 PM, Ken Kixmoeller -- reply to [EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote: >> >> On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: >> >> >> > I second that, you should base64 encode values before encrypting >> > and base6

Re: [PHP] Encryption failing

2008-01-16 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
Many thanks, Mike --- yours works great... 0 errors. On Jan 16, 2008, at 9:24 AM, mike wrote: function data_encrypt($data) { if(!$data) { return false; } return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $GLOBALS['config']['salt'], $data, 'cbc', md5($GLOBALS['config'][' s

Re: [PHP] Encryption failing

2008-01-16 Thread mike
On 1/16/08, Ken Kixmoeller -- reply to [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Jan 16, 2008, at 1:28 AM, Andrés Robinet wrote: > > His other post explains that php didn't seem to like spaces. No > spaces in the test strings -- I'll check for those when/if I can get > the core en/decrypt

Re: [PHP] Encryption failing

2008-01-16 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
On Jan 16, 2008, at 1:28 AM, Andrés Robinet wrote: 1 - Mike is right about first encrypting and then doing a base64_encode (then saving results to DB, cookies, etc). I don't know why replacing " " to "+" for decrypting, though. His other post explains that php didn't seem to like spaces

Re: [PHP] Encryption failing

2008-01-16 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
On Jan 15, 2008, at 10:48 PM, Casey wrote: It returns the correct value. If you look at the last example, and run base64_decode on "MDAwMzEwMDI0NDA0MTMyOQ==", you will get "0003100244041329". Oops. "Haste makes crappy programming." Ken -- PHP General Mailing List (http://www.php.net/) To un

Re: [PHP] Encryption failing

2008-01-15 Thread mike
On 1/15/08, Andrés Robinet <[EMAIL PROTECTED]> wrote: > 1 - Mike is right about first encrypting and then doing a base64_encode (then > saving results to DB, cookies, etc). I don't know why replacing " " to "+" > for decrypting, though. we have an application which sets an encrypted cookie in .

RE: [PHP] Encryption failing

2008-01-15 Thread Andrés Robinet
> -Original Message- > From: mike [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 16, 2008 1:49 AM > To: Ken Kixmoeller -- reply to [EMAIL PROTECTED] > Cc: php-general@lists.php.net > Subject: Re: [PHP] Encryption failing > > > -

Re: [PHP] Encryption failing

2008-01-15 Thread mike
> > if ($EorD == "D") { >$text_out = mdecrypt_generic($cypher,$text); >$text = base64_decode($text); shouldn't this be base64_decode($text_out) ? :) > } else { >$text= base64_encode($text); >$text_out = mcrypt_generic($cypher,$t

Re: [PHP] Encryption failing

2008-01-15 Thread Casey
On Jan 15, 2008 8:40 PM, Ken Kixmoeller -- reply to [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: > > > > I second that, you should base64 encode values before encrypting > > and base64 > > decode them after decrypting to be safe. > > > > Thank

Re: [PHP] Encryption failing

2008-01-15 Thread Ken Kixmoeller.com
On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: I second that, you should base64 encode values before encrypting and base64 decode them after decrypting to be safe. Thanks for the idea. Like this? Fails 500/500 times on my test. if ($EorD == "D") {

Re: [PHP] Encryption failing

2008-01-15 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: I second that, you should base64 encode values before encrypting and base64 decode them after decrypting to be safe. Thanks for the idea. Like this? Fails 500/500 times on my test. if ($EorD == "D")

Re: [PHP] Encryption failing

2008-01-15 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
On Jan 15, 2008, at 11:08 PM, Andrés Robinet wrote: -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 16, 2008 12:55 AM To: Ken Kixmoeller -- reply to [EMAIL PROTECTED]; php- [EMAIL PROTECTED] Subject: RE: [PHP] Encryption failing are you

RE: [PHP] Encryption failing

2008-01-15 Thread Andrés Robinet
> -Original Message- > From: Bastien Koert [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 16, 2008 12:55 AM > To: Ken Kixmoeller -- reply to [EMAIL PROTECTED]; php- > [EMAIL PROTECTED] > Subject: RE: [PHP] Encryption failing > > > are you base64 encodi

Re: [PHP] Encryption failing

2008-01-15 Thread mike
d that > there are problems with certain characters that can result from the > encryption, usually a combination of characters that approximate a null or > end of line > > bastien> From: [EMAIL PROTECTED]> Date: Tue, 15 Jan 2008 21:41:45 -0600> To: > php-general@lists.

RE: [PHP] Encryption failing

2008-01-15 Thread Bastien Koert
21:41:45 -0600> To: php-general@lists.php.net> Subject: Re: [PHP] Encryption failing> > > On Jan 15, 2008, at 7:06 PM, Casey wrote:> > >> Maybe you could echo the results of the failed ones and compare.> > I did that at first, thinking that "something a

Re: [PHP] Encryption failing

2008-01-15 Thread Ken Kixmoeller -- reply to [EMAIL PROTECTED]
On Jan 15, 2008, at 7:06 PM, Casey wrote: Maybe you could echo the results of the failed ones and compare. I did that at first, thinking that "something about these strings might cause the problem." But then I realized: I can't blame the data. I don't have any control over what users use

Re: [PHP] Encryption failing

2008-01-15 Thread Casey
On Jan 15, 2008, at 4:54 PM, "Ken Kixmoeller -- reply to [EMAIL PROTECTED] " <[EMAIL PROTECTED]> wrote: Hey --- - - I am in the process of upgrading the encryption technology I am using from (64 bit) blowfish to (256 bit) rijndael. The code (and some explanations) is below, but the results