note 47904 added to ref.mcrypt
| From: | Richardatmaxixsdotcom at osu1 dot php dot net | Date: | Sun, 05 Dec 2004 01:23:41 +0000 |
| Subject: | note 47904 added to ref.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81371@lists.php.net to get a copy of this message | ||
With the functions from "Anonymous" from 20th Nov, I really had the solution for my thing.
One extra solution, in case of password checking etc on 'open source' programs where you
can't set a fixed key, the input itself can also be the key!
You will have this then (with the mentioned function):
<?
/* for encryption */
$input = "MyPassword";
$encrypted = Encrypt($input,$input);
/* for decryption */
$decrypted = Decrypt($encrypted,$input);
if ($decrypted == $input) {
echo "Password correct!";
}
?>
Very valuable!
Cheers,
Richard
----
Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47904
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47904&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47904&report=yes
Search -- http://master.php.net/manage/user-notes.php