Encryption class based of AES. Originally written by Marcin F. Wiœniowski (marcin.wisniowski@mfw.pl).
| DLEncryption_Three | Encryption class based of AES. |
| Private Data | |
| $Sbox | (array) Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion. |
| $Rcon | (array) Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)]. |
| Inherit Methods | |
| Decrypt | Decrypt the given data using the given key. |
| Encrypt | Encrypt the given data using the given key. |
| Algorithm Specific Methods | |
| Cipher | Encrypt ‘input’ with Rijndael algorithm. |
| KeyExpansion | Performs key expansion on cipher key to generate a key schedule. |
| AESEncryptCtr | Encrypt a text using AES encryption in Counter mode of operation ~ see http://csrc.nist.gov |
| AESDecryptCtr | Decrypt a text encrypted by AES in counter mode of operation. |
| Urs | Unsigned right shift function, since PHP has neither >>> operator nor unsigned ints. |
private function Cipher( $input, $w )
Encrypt ‘input’ with Rijndael algorithm.
| $input | (array) Message as byte-array (16 bytes). |
| $w | (string) Key schedule as 2D byte-array (Nr+1 x Nb bytes) ~ generated from the cipher key by KeyExpansion. |
(array) Ciphertext as byte-array (16 bytes).
private function AESEncryptCtr( $plaintext, $password, $nBits )
Encrypt a text using AES encryption in Counter mode of operation ~ see http://csrc.nist.gov
Unicode multi-byte character safe.
| $plaintext | (string) Source text to be encrypted. |
| $password | (string) The password to use to generate a key. |
| $nBits | (numeric) Number of bits to be used in the key (128, 192, or 256). |
(string) Encrypted text.
private function AESDecryptCtr( $ciphertext, $password, $nBits )
Decrypt a text encrypted by AES in counter mode of operation.
| $ciphertext | (string) Source text to be decrypted. |
| $password | (string) The password to use to generate a key. |
| $nBits | (numeric) Number of bits to be used in the key (128, 192, or 256). |
(string) Decrypted text.
(array) Sbox is pre-computed multiplicative inverse in GF(2^8) used in SubBytes and KeyExpansion.
private $Sbox
(array) Rcon is Round Constant used for the Key Expansion [1st col is 2^(r-1) in GF(2^8)].
private $Rcon
Decrypt the given data using the given key.
public function Decrypt( $key, $data )
Encrypt the given data using the given key.
public function Encrypt( $key, $data )
Encrypt ‘input’ with Rijndael algorithm.
private function Cipher( $input, $w )
Performs key expansion on cipher key to generate a key schedule.
private function KeyExpansion( $key )
Encrypt a text using AES encryption in Counter mode of operation ~ see http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf
private function AESEncryptCtr( $plaintext, $password, $nBits )
Decrypt a text encrypted by AES in counter mode of operation.
private function AESDecryptCtr( $ciphertext, $password, $nBits )
Unsigned right shift function, since PHP has neither >>> operator nor unsigned ints.
private function Urs( $a, $b )
Decrypt the given data using the given key.
abstract public function Decrypt( $key, $data )
Encrypt the given data using the given key.
abstract public function Encrypt( $key, $data )