#22316 [NEW]: Crypt_RC4 destroys its sbox.
| From: | mike at graftonhall dot co dot nz | Date: | Thu, 20 Feb 2003 04:52:07 +0000 |
| Subject: | #22316 [NEW]: Crypt_RC4 destroys its sbox. | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-13487@lists.php.net to get a copy of this message | ||
From: mike at graftonhall dot co dot nz
Operating system: Windows 2000
PHP version: 4CVS-2003-02-19 (stable)
PHP Bug Type: PEAR related
Bug description: Crypt_RC4 destroys its sbox.
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 bug report at http://bugs.php.net/?id=22316&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=22316&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=22316&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=22316&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=22316&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=22316&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=22316&r=support
Expected behavior: http://bugs.php.net/fix.php?id=22316&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=22316&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=22316&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=22316&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22316&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=22316&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=22316&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=22316&r=gnused