FOF30\Encrypt\Aes::__construct PHP Method

__construct() public method

Initialise the AES encryption object
public __construct ( string $key, integer $strength = 256, string $mode = 'cbc' )
$key string The encryption key (password). It can be a raw key (32 bytes) or a passphrase.
$strength integer Bit strength (128, 192 or 256)
$mode string Ecnryption mode. Can be ebc or cbc. We recommend using cbc.
    public function __construct($key, $strength = 256, $mode = 'cbc')
    {
        $this->keyString = $key;
        switch ($strength) {
            case 256:
            default:
                $this->cipherType = MCRYPT_RIJNDAEL_256;
                break;
            case 192:
                $this->cipherType = MCRYPT_RIJNDAEL_192;
                break;
            case 128:
                $this->cipherType = MCRYPT_RIJNDAEL_128;
                break;
        }
        switch (strtoupper($mode)) {
            case 'ECB':
                $this->cipherMode = MCRYPT_MODE_ECB;
                break;
            case 'CBC':
                $this->cipherMode = MCRYPT_MODE_CBC;
                break;
        }
    }