#22316 [Opn->Asn]: Crypt_RC4 destroys its sbox.
| From: | lsmith@php.net | Date: | Mon, 05 May 2003 10:09:07 +0000 |
| Subject: | #22316 [Opn->Asn]: Crypt_RC4 destroys its sbox. | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-15872@lists.php.net to get a copy of this message | ||
ID: 22316
Updated by: lsmith@php.net
Reported By: mike at graftonhall dot co dot nz
-Status: Open
+Status: Assigned
Bug Type: PEAR related
Operating System: Windows 2000
PHP Version: 4CVS-2003-02-19 (stable)
-Assigned To:
+Assigned To: zyprexia
Previous Comments:
------------------------------------------------------------------------
[2003-02-19 22:52:07] mike at graftonhall dot co dot nz
The Crypt_RC4::crypt() routine (and Crypt_RC4::decrypt()) destroys the
sbox created in Crypt_RC4::key() causes the example code to no work.
So the code in the comment:
Usage:
$key = "pear";
$message = "PEAR rulez!";
$rc4 = new RC4;
$rc4->key($key);
echo "Original message: $message <br>\n";
$rc4->crypt($message);
echo "Encrypted message: $message <br>\n";
$rc4->decrypt($message);
echo "Decrypted message: $message <br>\n";
Does not work. For two reasons, first the class is nor Crypt_RC4 and
second after crypt() has been called the sbox has been modified and so
neither crypt nor decrypt will work correctly.
The example code should currently read:
Usage:
$key = "pear";
$message = "PEAR rulez!";
$rc4 = new Crypt_RC4;
$rc4->key($key);
echo "Original message: $message <br>\n";
$rc4->crypt($message);
echo "Encrypted message: $message <br>\n";
$rc4->key($key);
$rc4->decrypt($message);
echo "Decrypted message: $message <br>\n";
Note the extra key() call.
- Mike :-)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22316&edit=1