|  | Posted by Jeremy Deuel on 02/17/06 22:06 
In article <1140181912.627470.148460@g43g2000cwa.googlegroups.com>,"Sjoerd" <sjoerder@gmail.com> wrote:
 
 > Jeremy Deuel wrote:
 > > Just an Idea:
 > > In PHP, passwords for different purposes often are stored plaintext in
 > > the source. I often wondered, how this could be prevented.
 >
 > Nice functions, and not that simple to decrypt.
 >
 > People already thought about this, and came up with the following:
 > XOR "encryption": A bitwise XOR (exclusive or, ^ operator) is done for
 > every character of the string. The key is repeated, as in your example.
 > The advantage is that encryption and decryption uses the same function:
 > Doing a XOR on a string twice will result in the original string.
 > ROT-13: Rotate the alphabet with 13 positions: A becomes N, B becomes
 > O, etc. Because there are 26 letters in the alphabet, doing a ROT-13
 > twice will result in the original string.
 >
 > Also take a look at str_repeat(), which can repeat the key so that it
 > is long enough. You can use the % operator instead of fmod().
 
 Thanks for str_repeat and the % operator. I didn't know them yet..
 
 ROT-13 is not thaaaaaat safe... ;)
 XOR would be very interesting, like this one could implement the
 vernam-algorithm. How do I implement bitwise operations in PHP?
 [Back to original message] |