note 107352 added to ref.mcrypt
| From: | ignacio at sait dot com dot mx | Date: | Thu, 02 Feb 2012 15:08:53 +0000 |
| Subject: | note 107352 added to ref.mcrypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185831@lists.php.net to get a copy of this message | ||
RC4 in Php by Ignacio Gutierrez Torrero @ SAIT Software Administrativo
RC4 (ARC4,ARCFOUR) is the most widely used software stream cipher and is used in popular protocols
(SSL, TLS, WEP, RDP) applications: (Skype, SAIT Software Administrativo, PDF, SecureShell,
OperaMini), here is an example of rc4_crypt using php:
<?php
$key = 'SAIT';
$msg = 'IGNACIO LOVES ELIZABETH';
$encrypted = rc4_crypt($key, $msg);
echo 'encrypted bin: ', $encrypted, '<br>';
echo 'encrypted b64: ', base64_encode($encrypted) ,'<br>';
echo 'encrypted hex: ', bin2hex($encrypted), '<br>';
function rc4_crypt($key,$msg) {
$td = mcrypt_module_open('arcfour', '' , 'stream', '');
mcrypt_generic_init($td, $key, null);
$encrypted = mcrypt_generic($td, $msg);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
return $encrypted;
}
function rc4_decrypt($key,$msg) {
return rc4_crypt($key,$msg);
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 189.222.30.97
----
Manual Page -- http://www.php.net/manual/en/ref.mcrypt.php
Edit -- https://master.php.net/note/edit/107352
Del: integrated -- https://master.php.net/note/delete/107352/integrated
Del: useless -- https://master.php.net/note/delete/107352/useless
Del: bad code -- https://master.php.net/note/delete/107352/bad+code
Del: spam -- https://master.php.net/note/delete/107352/spam
Del: non-english -- https://master.php.net/note/delete/107352/non-english
Del: in docs -- https://master.php.net/note/delete/107352/in+docs
Del: other reasons-- https://master.php.net/note/delete/107352
Reject -- https://master.php.net/note/reject/107352
Search -- https://master.php.net/manage/user-notes.php