class CryptoKey

libsodium wrapper class for keys

Constants

FAST_OPS

FAST_MEMORY

Methods

static string
GenerateSalt()

Generates a salt for use with DeriveKey()

static string
DeriveKey(string $password, string $salt, int $bytes, bool $fast = false)

Generates an encryption key from a password

Details

at line 14
static string GenerateSalt()

Generates a salt for use with DeriveKey()

Return Value

string

at line 29
static string DeriveKey(string $password, string $salt, int $bytes, bool $fast = false)

Generates an encryption key from a password

Parameters

string $password

the password to derive the key from

string $salt

a generated salt to use

int $bytes

the number of bytes required to output

bool $fast

if true, does a very fast transformation (use only if the password is itself a key)

Return Value

string

the derived binary key