mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-04 12:58:28 +00:00
Hans-Jürgen Petrich
359e38b4d4
fixed corrupted decrypt() in CTR mode
$buffer['encrypted'] (which is always empty) should be $buffer['ciphertext'] or buffered stream will get corrupt... Example: define('CRYPT_AES_MODE',CRYPT_AES_MODE_INTERNAL);//in MODE_MCRYPT all is fine $aes = new Crypt_AES(CRYPT_AES_MODE_CTR); $aes->setKey(':-8'); $aes->enableContinuousBuffer(); $plaintext = ':-):-):-):-):-):-)'; for($i=0; $i<strlen($plaintext); $i++) { echo $aes->Decrypt($aes->Encrypt($plaintext[$i])); } Output: :-):-):-):-):-):-( Expected: :-):-):-):-):-):-) After Bugfix, output is: :-):-):-):-):-):-)
phpseclib - PHP Secure Communications Library
MIT-licensed pure-PHP implementations of an arbitrary-precision integer arithmetic library, fully PKCS#1 (v2.1) compliant RSA, DES, 3DES, RC4, Rijndael, AES, SSH-1, SSH-2, SFTP, and X.509
PEAR Channel: [phpseclib.sourceforge.net](http://phpseclib.sourceforge.net/pear.htm)
Languages
PHP
100%