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
> -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
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
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;
>
$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
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);
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
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);
}
//now, to shuffle
for
8 matches
Mail list logo