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, int $n, int $r, int $p, int $length) : string

Parameters

$password

string

$salt

string

$n

int

CPU cost

$r

int

Memory cost

$p

int

parallelization cost

$length

int

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) : int

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

int

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, int $r) : string

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

Parameters

$b

string

$r

int

Returns

string

scryptROMix

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

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

Parameters

$b

string

$n

int

$r

int

Returns

string