Re: Amendment to String Problem

From: Date: Thu, 10 Apr 2003 13:23:43 +0000
Subject: Re: Amendment to String Problem
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-26989@lists.php.net to get a copy of this message
Well, m is more or less in the middle of the alphabet, thus you've made your changes, so it will bounce back and forth between n & m. Actually it's working perfectly, and is rather neat, although not what you intended. Treat your password as an array, step through it, and apply the changes letter by letter. Slightly OT - What are you trying to accomplish? All you are really doing is inverting the password -- isn't that one of the first things a cracker will try? (If answered earlier in thread, ignore.) Cheers - Miles At 10:56 PM 4/9/2003 -0400, Chris Payne wrote:
Hi there Everyone, Here's a better example of the problem i'm having, there is probably a MUCH better way to do this, but here goes. I am using the following code: $passroutine = 'abcdefghijklmnopqrstuvwxyz'; $passroutine = str_replace("a", "z", $passroutine); $passroutine = str_replace("b", "y", $passroutine); $passroutine = str_replace("c", "x", $passroutine); $passroutine = str_replace("d", "w", $passroutine); $passroutine = str_replace("e", "v", $passroutine); $passroutine = str_replace("f", "u", $passroutine); $passroutine = str_replace("g", "t", $passroutine); $passroutine = str_replace("h", "s", $passroutine); $passroutine = str_replace("i", "r", $passroutine); $passroutine = str_replace("j", "q", $passroutine); $passroutine = str_replace("k", "p", $passroutine); $passroutine = str_replace("l", "o", $passroutine); $passroutine = str_replace("m", "n", $passroutine); $passroutine = str_replace("n", "m", $passroutine); $passroutine = str_replace("o", "l", $passroutine); $passroutine = str_replace("p", "k", $passroutine); $passroutine = str_replace("q", "j", $passroutine); $passroutine = str_replace("r", "i", $passroutine); $passroutine = str_replace("s", "h", $passroutine); $passroutine = str_replace("t", "g", $passroutine); $passroutine = str_replace("u", "f", $passroutine); $passroutine = str_replace("v", "e", $passroutine); $passroutine = str_replace("w", "d", $passroutine); $passroutine = str_replace("x", "c", $passroutine); $passroutine = str_replace("y", "b", $passroutine); $passroutine = str_replace("z", "a", $passroutine); which is SUPPOSED to replace letters, a because z and so on, but after it gets to m it screws up and displays: abcdefghijklmmlkjihgfedcba How can I do the above code in such a way that it won't produce this problem? Any help will be greatly appreciated :-) Regards Chris


« previous php.db (#26989) next »