Dcrypt\Cryptobase::key PHP Method

key() protected static method

Transform password into key and perform iterative HMAC (if specified)
protected static key ( string $password, string $iv, integer $cost, string $cipher = 'rijndael-128', string $mode = 'cbc', string $algo = 'sha256' ) : string
$password string Encryption key
$iv string Initialization vector
$cost integer Number of HMAC iterations to perform on key
$cipher string Mcrypt cipher
$mode string Mcrypt block mode
$algo string Hashing algorithm to use for internal operations
return string
    protected static function key($password, $iv, $cost, $cipher = 'rijndael-128', $mode = 'cbc', $algo = 'sha256')
    {
        // This if statement allows the usage of the Openssl library without
        // the need to have the mcrypt plugin installed at all.
        if ($cipher === 'rijndael-128') {
            $keysize = 32;
        } else {
            $keysize = \mcrypt_get_key_size($cipher, $mode);
        }
        // Perform key derivation
        $key = Hash::ihmac($iv . $cipher . $mode, $password, $cost, $algo);
        // Return hash normalized to key length
        return self::hashNormalize($key, $keysize, $algo);
    }