Re: [PHP] Trying to create an encryption method

2006-11-06 Thread John Meyer
Adapted something from this list and that worked, thanks for the help. Richard Lynch wrote: > On Sat, November 4, 2006 10:15 pm, John Meyer wrote: > >> I'm trying to create this encryption method for puzzles (nothing super >> secret, just those cryptograms), but this seems to time out, can >> a

RE: [PHP] Trying to create an encryption method

2006-11-06 Thread Daevid Vincent
> -Original Message- > (strlen(trim($normalAlphabet[$k])) === 0)); Not sure if this is it, but be careful with the === vs == DÆVID -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Trying to create an encryption method

2006-11-06 Thread Richard Lynch
On Sat, November 4, 2006 10:15 pm, John Meyer wrote: > I'm trying to create this encryption method for puzzles (nothing super > secret, just those cryptograms), but this seems to time out, can > anybody > point out what I'm doing wrong here: http://php.net/shuffle -- Some people have a "gift" li

Re: [PHP] Trying to create an encryption method

2006-11-05 Thread John Meyer
Modified the script, and that's what I needed, thanks. Jochem Maas wrote: > $secret = "HalloWorld"; > $encoded = ""; > > $a = $b = range("a","z"); > shuffle($b); > $c = array_combine($a, $b); > > foreach (str_split(strtolower($secret)) as $v) > $encoded .= isset($c[ $v ]) ? $c[ $v ] : $v; >

Re: [PHP] Trying to create an encryption method

2006-11-05 Thread Jochem Maas
$secret = "HalloWorld"; $encoded = ""; $a = $b = range("a","z"); shuffle($b); $c = array_combine($a, $b); foreach (str_split(strtolower($secret)) as $v) $encoded .= isset($c[ $v ]) ? $c[ $v ] : $v; var_dump($c, $secret, $encoded); Paul Novitski wrote: > At 11/4/2006 08:15 PM, John Me

Re: [PHP] Trying to create an encryption method

2006-11-04 Thread Paul Novitski
At 11/4/2006 08:15 PM, John Meyer wrote: I'm trying to create this encryption method for puzzles (nothing super secret, just those cryptograms), but this seems to time out, can anybody point out what I'm doing wrong here: for ($i=1;$i<=26;$i++) { $normalAlphabet[$i] = chr($i);

Re: [PHP] Trying to create an encryption method

2006-11-04 Thread Stut
John Meyer wrote: for ($i=1;$i<=26;$i++) { $normalAlphabet[$i] = chr($i); } //now, to shuffle for ($j=1;$j<=26;$j++) { do { $k = rand(1,26); } while ($k == $j || (strlen(trim($normalAlphabet[$k])) === 0)); $arEnc