CS adjustment

This commit is contained in:
Hans-Jürgen Petrich 2013-05-25 11:22:25 +07:00
parent 995c09cb67
commit 5429504aee
7 changed files with 55 additions and 13 deletions

View File

@ -156,10 +156,15 @@ class Crypt_AES extends Crypt_Rijndael {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_AES_MODE_ECB * - CRYPT_AES_MODE_ECB
*
* - CRYPT_AES_MODE_CBC * - CRYPT_AES_MODE_CBC
*
* - CRYPT_AES_MODE_CTR * - CRYPT_AES_MODE_CTR
*
* - CRYPT_AES_MODE_CFB * - CRYPT_AES_MODE_CFB
*
* - CRYPT_AES_MODE_OFB * - CRYPT_AES_MODE_OFB
* *
* If not explictly set, CRYPT_AES_MODE_CBC will be used. * If not explictly set, CRYPT_AES_MODE_CBC will be used.

View File

@ -407,11 +407,17 @@ class Crypt_Base {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_MODE_ECB * - CRYPT_MODE_ECB
*
* - CRYPT_MODE_CBC * - CRYPT_MODE_CBC
*
* - CRYPT_MODE_CTR * - CRYPT_MODE_CTR
*
* - CRYPT_MODE_CFB * - CRYPT_MODE_CFB
*
* - CRYPT_MODE_OFB * - CRYPT_MODE_OFB
*
* (or the alias constants of the choosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...) * (or the alias constants of the choosen cipher, for example for AES: CRYPT_AES_MODE_ECB or CRYPT_AES_MODE_CBC ...)
* *
* If not explictly set, CRYPT_MODE_CBC will be used. * If not explictly set, CRYPT_MODE_CBC will be used.
@ -608,7 +614,7 @@ class Crypt_Base {
$this->enchanged = false; $this->enchanged = false;
} }
// re: http://phpseclib.sourceforge.net/cfb-demo.phps // re: {@link http://phpseclib.sourceforge.net/cfb-demo.phps}
// using mcrypt's default handing of CFB the above would output two different things. using phpseclib's // using mcrypt's default handing of CFB the above would output two different things. using phpseclib's
// rewritten CFB implementation the above outputs the same thing twice. // rewritten CFB implementation the above outputs the same thing twice.
if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) { if ($this->mode == CRYPT_MODE_CFB && $this->continuousBuffer) {
@ -737,7 +743,7 @@ class Crypt_Base {
break; break;
case CRYPT_MODE_CFB: case CRYPT_MODE_CFB:
// cfb loosely routines inspired by openssl's: // cfb loosely routines inspired by openssl's:
// http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1 // {@link http://cvs.openssl.org/fileview?f=openssl/crypto/modes/cfb128.c&v=1.3.2.2.2.1}
if ($this->continuousBuffer) { if ($this->continuousBuffer) {
$iv = &$this->encryptIV; $iv = &$this->encryptIV;
$pos = &$buffer['pos']; $pos = &$buffer['pos'];
@ -876,7 +882,7 @@ class Crypt_Base {
} }
if ($this->paddable) { if ($this->paddable) {
// we pad with chr(0) since that's what mcrypt_generic does. to quote from http://php.net/function.mcrypt-generic : // we pad with chr(0) since that's what mcrypt_generic does. to quote from {@link http://www.php.net/function.mcrypt-generic}:
// "The data is padded with "\0" to make sure the length of the data is n * blocksize." // "The data is padded with "\0" to make sure the length of the data is n * blocksize."
$ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($block_size - strlen($ciphertext) % $block_size) % $block_size, chr(0)); $ciphertext = str_pad($ciphertext, strlen($ciphertext) + ($block_size - strlen($ciphertext) % $block_size) % $block_size, chr(0));
} }
@ -1193,11 +1199,16 @@ class Crypt_Base {
* *
* _mcryptSetup() will be called each time if $changed === true * _mcryptSetup() will be called each time if $changed === true
* typically this happens when using one or more of following public methods: * typically this happens when using one or more of following public methods:
*
* - setKey() * - setKey()
*
* - setIV() * - setIV()
*
* - disableContinuousBuffer() * - disableContinuousBuffer()
*
* - First run of encrypt() / decrypt() * - First run of encrypt() / decrypt()
* *
*
* Note: Could, but not must, extend by the child Crypt_* class * Note: Could, but not must, extend by the child Crypt_* class
* *
* @see setKey() * @see setKey()

View File

@ -375,10 +375,15 @@ class Crypt_Blowfish extends Crypt_Base {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_BLOWFISH_MODE_ECB * - CRYPT_BLOWFISH_MODE_ECB
*
* - CRYPT_BLOWFISH_MODE_CBC * - CRYPT_BLOWFISH_MODE_CBC
*
* - CRYPT_BLOWFISH_MODE_CTR * - CRYPT_BLOWFISH_MODE_CTR
*
* - CRYPT_BLOWFISH_MODE_CFB * - CRYPT_BLOWFISH_MODE_CFB
*
* - CRYPT_BLOWFISH_MODE_OFB * - CRYPT_BLOWFISH_MODE_OFB
* *
* If not explictly set, CRYPT_BLOWFISH_MODE_CBC will be used. * If not explictly set, CRYPT_BLOWFISH_MODE_CBC will be used.

View File

@ -669,10 +669,15 @@ class Crypt_DES extends Crypt_Base {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_DES_MODE_ECB * - CRYPT_DES_MODE_ECB
*
* - CRYPT_DES_MODE_CBC * - CRYPT_DES_MODE_CBC
*
* - CRYPT_DES_MODE_CTR * - CRYPT_DES_MODE_CTR
*
* - CRYPT_DES_MODE_CFB * - CRYPT_DES_MODE_CFB
*
* - CRYPT_DES_MODE_OFB * - CRYPT_DES_MODE_OFB
* *
* If not explictly set, CRYPT_DES_MODE_CBC will be used. * If not explictly set, CRYPT_DES_MODE_CBC will be used.

View File

@ -666,10 +666,15 @@ class Crypt_Rijndael extends Crypt_Base {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_RIJNDAEL_MODE_ECB * - CRYPT_RIJNDAEL_MODE_ECB
*
* - CRYPT_RIJNDAEL_MODE_CBC * - CRYPT_RIJNDAEL_MODE_CBC
*
* - CRYPT_RIJNDAEL_MODE_CTR * - CRYPT_RIJNDAEL_MODE_CTR
*
* - CRYPT_RIJNDAEL_MODE_CFB * - CRYPT_RIJNDAEL_MODE_CFB
*
* - CRYPT_RIJNDAEL_MODE_OFB * - CRYPT_RIJNDAEL_MODE_OFB
* *
* If not explictly set, CRYPT_RIJNDAEL_MODE_CBC will be used. * If not explictly set, CRYPT_RIJNDAEL_MODE_CBC will be used.

View File

@ -81,7 +81,7 @@ define('CRYPT_DES_MODE_CBC3', CRYPT_DES_MODE_CBC);
* @author Jim Wigginton <terrafrost@php.net> * @author Jim Wigginton <terrafrost@php.net>
* @version 0.1.0 * @version 0.1.0
* @access public * @access public
* @package Crypt_TerraDES * @package Crypt_TripleDES
*/ */
class Crypt_TripleDES extends Crypt_DES { class Crypt_TripleDES extends Crypt_DES {
/** /**
@ -168,11 +168,17 @@ class Crypt_TripleDES extends Crypt_DES {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_DES_MODE_ECB * - CRYPT_DES_MODE_ECB
*
* - CRYPT_DES_MODE_CBC * - CRYPT_DES_MODE_CBC
*
* - CRYPT_DES_MODE_CTR * - CRYPT_DES_MODE_CTR
*
* - CRYPT_DES_MODE_CFB * - CRYPT_DES_MODE_CFB
*
* - CRYPT_DES_MODE_OFB * - CRYPT_DES_MODE_OFB
*
* - CRYPT_DES_MODE_3CBC * - CRYPT_DES_MODE_3CBC
* *
* If not explictly set, CRYPT_DES_MODE_CBC will be used. * If not explictly set, CRYPT_DES_MODE_CBC will be used.

View File

@ -454,10 +454,15 @@ class Crypt_Twofish extends Crypt_Base {
* Determines whether or not the mcrypt extension should be used. * Determines whether or not the mcrypt extension should be used.
* *
* $mode could be: * $mode could be:
*
* - CRYPT_TWOFISH_MODE_ECB * - CRYPT_TWOFISH_MODE_ECB
*
* - CRYPT_TWOFISH_MODE_CBC * - CRYPT_TWOFISH_MODE_CBC
*
* - CRYPT_TWOFISH_MODE_CTR * - CRYPT_TWOFISH_MODE_CTR
*
* - CRYPT_TWOFISH_MODE_CFB * - CRYPT_TWOFISH_MODE_CFB
*
* - CRYPT_TWOFISH_MODE_OFB * - CRYPT_TWOFISH_MODE_OFB
* *
* If not explictly set, CRYPT_TWOFISH_MODE_CBC will be used. * If not explictly set, CRYPT_TWOFISH_MODE_CBC will be used.