Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/worker/src/PHPSecLi.../Crypt
File: AES.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/**
[2] Fix | Delete
* Pure-PHP implementation of AES.
[3] Fix | Delete
*
[4] Fix | Delete
* Uses mcrypt, if available/possible, and an internal implementation, otherwise.
[5] Fix | Delete
*
[6] Fix | Delete
* PHP versions 4 and 5
[7] Fix | Delete
*
[8] Fix | Delete
* If {@link Crypt_AES::setKeyLength() setKeyLength()} isn't called, it'll be calculated from
[9] Fix | Delete
* {@link Crypt_AES::setKey() setKey()}. ie. if the key is 128-bits, the key length will be 128-bits. If it's 136-bits
[10] Fix | Delete
* it'll be null-padded to 192-bits and 192 bits will be the key length until {@link Crypt_AES::setKey() setKey()}
[11] Fix | Delete
* is called, again, at which point, it'll be recalculated.
[12] Fix | Delete
*
[13] Fix | Delete
* Since Crypt_AES extends Crypt_Rijndael, some functions are available to be called that, in the context of AES, don't
[14] Fix | Delete
* make a whole lot of sense. {@link Crypt_AES::setBlockLength() setBlockLength()}, for instance. Calling that function,
[15] Fix | Delete
* however possible, won't do anything (AES has a fixed block length whereas Rijndael has a variable one).
[16] Fix | Delete
*
[17] Fix | Delete
* Here's a short example of how to use this library:
[18] Fix | Delete
* <code>
[19] Fix | Delete
* <?php
[20] Fix | Delete
* include 'Crypt/AES.php';
[21] Fix | Delete
*
[22] Fix | Delete
* $aes = new Crypt_AES();
[23] Fix | Delete
*
[24] Fix | Delete
* $aes->setKey('abcdefghijklmnop');
[25] Fix | Delete
*
[26] Fix | Delete
* $size = 10 * 1024;
[27] Fix | Delete
* $plaintext = '';
[28] Fix | Delete
* for ($i = 0; $i < $size; $i++) {
[29] Fix | Delete
* $plaintext.= 'a';
[30] Fix | Delete
* }
[31] Fix | Delete
*
[32] Fix | Delete
* echo $aes->decrypt($aes->encrypt($plaintext));
[33] Fix | Delete
* ?>
[34] Fix | Delete
* </code>
[35] Fix | Delete
*
[36] Fix | Delete
* LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
[37] Fix | Delete
* of this software and associated documentation files (the "Software"), to deal
[38] Fix | Delete
* in the Software without restriction, including without limitation the rights
[39] Fix | Delete
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
[40] Fix | Delete
* copies of the Software, and to permit persons to whom the Software is
[41] Fix | Delete
* furnished to do so, subject to the following conditions:
[42] Fix | Delete
*
[43] Fix | Delete
* The above copyright notice and this permission notice shall be included in
[44] Fix | Delete
* all copies or substantial portions of the Software.
[45] Fix | Delete
*
[46] Fix | Delete
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
[47] Fix | Delete
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
[48] Fix | Delete
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
[49] Fix | Delete
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
[50] Fix | Delete
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
[51] Fix | Delete
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
[52] Fix | Delete
* THE SOFTWARE.
[53] Fix | Delete
*
[54] Fix | Delete
* @category Crypt
[55] Fix | Delete
* @package Crypt_AES
[56] Fix | Delete
* @author Jim Wigginton <terrafrost@php.net>
[57] Fix | Delete
* @copyright MMVIII Jim Wigginton
[58] Fix | Delete
* @license http://www.opensource.org/licenses/mit-license.html MIT License
[59] Fix | Delete
* @link http://phpseclib.sourceforge.net
[60] Fix | Delete
*/
[61] Fix | Delete
[62] Fix | Delete
/**
[63] Fix | Delete
* Include Crypt_Rijndael
[64] Fix | Delete
*/
[65] Fix | Delete
if (!class_exists('Crypt_Rijndael')) {
[66] Fix | Delete
require_once dirname(__FILE__).'/Rijndael.php';
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
/**#@+
[70] Fix | Delete
* @access public
[71] Fix | Delete
* @see Crypt_AES::encrypt()
[72] Fix | Delete
* @see Crypt_AES::decrypt()
[73] Fix | Delete
*/
[74] Fix | Delete
/**
[75] Fix | Delete
* Encrypt / decrypt using the Counter mode.
[76] Fix | Delete
*
[77] Fix | Delete
* Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
[78] Fix | Delete
*
[79] Fix | Delete
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
[80] Fix | Delete
*/
[81] Fix | Delete
define('CRYPT_AES_MODE_CTR', CRYPT_MODE_CTR);
[82] Fix | Delete
/**
[83] Fix | Delete
* Encrypt / decrypt using the Electronic Code Book mode.
[84] Fix | Delete
*
[85] Fix | Delete
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
[86] Fix | Delete
*/
[87] Fix | Delete
define('CRYPT_AES_MODE_ECB', CRYPT_MODE_ECB);
[88] Fix | Delete
/**
[89] Fix | Delete
* Encrypt / decrypt using the Code Book Chaining mode.
[90] Fix | Delete
*
[91] Fix | Delete
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
[92] Fix | Delete
*/
[93] Fix | Delete
define('CRYPT_AES_MODE_CBC', CRYPT_MODE_CBC);
[94] Fix | Delete
/**
[95] Fix | Delete
* Encrypt / decrypt using the Cipher Feedback mode.
[96] Fix | Delete
*
[97] Fix | Delete
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
[98] Fix | Delete
*/
[99] Fix | Delete
define('CRYPT_AES_MODE_CFB', CRYPT_MODE_CFB);
[100] Fix | Delete
/**
[101] Fix | Delete
* Encrypt / decrypt using the Cipher Feedback mode.
[102] Fix | Delete
*
[103] Fix | Delete
* @link http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
[104] Fix | Delete
*/
[105] Fix | Delete
define('CRYPT_AES_MODE_OFB', CRYPT_MODE_OFB);
[106] Fix | Delete
/**#@-*/
[107] Fix | Delete
[108] Fix | Delete
/**#@+
[109] Fix | Delete
* @access private
[110] Fix | Delete
* @see Crypt_Base::Crypt_Base()
[111] Fix | Delete
*/
[112] Fix | Delete
/**
[113] Fix | Delete
* Toggles the internal implementation
[114] Fix | Delete
*/
[115] Fix | Delete
define('CRYPT_AES_MODE_INTERNAL', CRYPT_MODE_INTERNAL);
[116] Fix | Delete
/**
[117] Fix | Delete
* Toggles the mcrypt implementation
[118] Fix | Delete
*/
[119] Fix | Delete
define('CRYPT_AES_MODE_MCRYPT', CRYPT_MODE_MCRYPT);
[120] Fix | Delete
/**#@-*/
[121] Fix | Delete
[122] Fix | Delete
/**
[123] Fix | Delete
* Pure-PHP implementation of AES.
[124] Fix | Delete
*
[125] Fix | Delete
* @package Crypt_AES
[126] Fix | Delete
* @author Jim Wigginton <terrafrost@php.net>
[127] Fix | Delete
* @access public
[128] Fix | Delete
*/
[129] Fix | Delete
class Crypt_AES extends Crypt_Rijndael
[130] Fix | Delete
{
[131] Fix | Delete
/**
[132] Fix | Delete
* The namespace used by the cipher for its constants.
[133] Fix | Delete
*
[134] Fix | Delete
* @see Crypt_Base::const_namespace
[135] Fix | Delete
* @var String
[136] Fix | Delete
* @access private
[137] Fix | Delete
*/
[138] Fix | Delete
public $const_namespace = 'AES';
[139] Fix | Delete
[140] Fix | Delete
/**
[141] Fix | Delete
* Dummy function
[142] Fix | Delete
*
[143] Fix | Delete
* Since Crypt_AES extends Crypt_Rijndael, this function is, technically, available, but it doesn't do anything.
[144] Fix | Delete
*
[145] Fix | Delete
* @see Crypt_Rijndael::setBlockLength()
[146] Fix | Delete
* @access public
[147] Fix | Delete
*
[148] Fix | Delete
* @param Integer $length
[149] Fix | Delete
*/
[150] Fix | Delete
public function setBlockLength($length)
[151] Fix | Delete
{
[152] Fix | Delete
return;
[153] Fix | Delete
}
[154] Fix | Delete
}
[155] Fix | Delete
[156] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function