note 79379 deleted from function.crypt by ezyang
| From: | ezyang@php.net | Date: | Sat, 24 Nov 2007 00:03:25 +0000 |
| Subject: | note 79379 deleted from function.crypt by ezyang | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-132518@lists.php.net to get a copy of this message | ||
Note Submitter: darren at skillkeeper dot com
Reason: useless
----
Why not just do the following:
<?php
//Encrypt:
$var1 = "Hello world" ^ "EVPOECJGTFEKKUHDTSAPN";
echo $var1
//Result = 3<#*c=(&*!
//Decrypt:
$var2 = $var1 ^ "EVPOECJGTFEKKUHDTSAPN";
echo $var2."\r\n";
//Result = Hello world
?>
The ^ operator (XOR) comes in handy here.
The mask (EVPOE...) has to be as long or longer than the text to be en/de-cryped.
Enjoy;
Darren
www.skillkeeper.com