Scrypt key derivation function

see \Zend\Crypt\Key\Derivation\http://www.tarsnap.com/scrypt.html
see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01

 Methods

Execute the scrypt algorithm

calc(string $password, string $salt, integer $n, integer $r, integer $p, integer $length) : string

Parameters

$password

string

$salt

string

$n

integer

CPU cost

$r

integer

Memory cost

$p

integer

parallelization cost

$length

integer

size of the output key

Returns

string

Convert hex string in a binary string

hex2bin(string $hex) : string

Parameters

$hex

string

Returns

string

Integerify

integerify(string $b) : integer

Integerify (B[0] ... B[2 * r - 1]) is defined as the result of interpreting B[2 * r - 1] as a little-endian integer. Each block B is a string of 64 bytes.

see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-4

Parameters

$b

string

Returns

integer

Salsa 20/8 core (32 bit version)

salsa208Core32(string $b) : string

see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-2
see \Zend\Crypt\Key\Derivation\http://cr.yp.to/salsa20.html

Parameters

$b

string

Returns

string

Salsa 20/8 core (64 bit version)

salsa208Core64(string $b) : string

see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-2
see \Zend\Crypt\Key\Derivation\http://cr.yp.to/salsa20.html

Parameters

$b

string

Returns

string

scryptBlockMix

scryptBlockMix(string $b, integer $r) : string

see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-3

Parameters

$b

string

$r

integer

Returns

string

scryptROMix

scryptROMix(string $b, integer $n, integer $r) : string

see \Zend\Crypt\Key\Derivation\https://tools.ietf.org/html/draft-josefsson-scrypt-kdf-01#section-4

Parameters

$b

string

$n

integer

$r

integer

Returns

string