Constants

DIGESTION_KEY_128_BITS

DIGESTION_KEY_128_BITS

The hash digestion key 128-bit size.

DIGESTION_KEY_160_BITS

DIGESTION_KEY_160_BITS

The hash digestion key 160-bit size.

DIGESTION_KEY_224_BITS

DIGESTION_KEY_224_BITS

The hash digestion key 224-bit size.

DIGESTION_KEY_256_BITS

DIGESTION_KEY_256_BITS

The hash digestion key 256-bit size.

DIGESTION_KEY_320_BITS

DIGESTION_KEY_320_BITS

The hash digestion key 320-bit size.

DIGESTION_KEY_384_BITS

DIGESTION_KEY_384_BITS

The hash digestion key 384-bit size.

DIGESTION_KEY_512_BITS

DIGESTION_KEY_512_BITS

The hash digestion key 512-bit size.

DIGESTION_SALT_128_BITS

DIGESTION_SALT_128_BITS

The hash digestion salt 128-bit size.

DIGESTION_SALT_160_BITS

DIGESTION_SALT_160_BITS

The hash digestion salt 160-bit size.

DIGESTION_SALT_224_BITS

DIGESTION_SALT_224_BITS

The hash digestion salt 224-bit size.

DIGESTION_SALT_256_BITS

DIGESTION_SALT_256_BITS

The hash digestion salt 256-bit size.

DIGESTION_SALT_320_BITS

DIGESTION_SALT_320_BITS

The hash digestion salt 320-bit size.

DIGESTION_SALT_384_BITS

DIGESTION_SALT_384_BITS

The hash digestion salt 384-bit size.

DIGESTION_SALT_512_BITS

DIGESTION_SALT_512_BITS

The hash digestion salt 512-bit size.

Methods

getHashingKey()

getHashingKey(integer  $length = self::DIGESTION_KEY_128_BITS, boolean|integer  $printable = true) : string

Generate a random HMAC key for hashing purposes.

Note: The output string can be in raw bytes of the $printable parameter is set to true.

Parameters

integer $length

The desired output length (default => 16).

boolean|integer $printable

Flag for using only printable characters instead of bytes (default => true).

Returns

string —

Randomly generated HMAC key.

getHashingSalt()

getHashingSalt(integer  $length = self::DIGESTION_SALT_128_BITS, boolean|integer  $printable = true) : string

Generate a random salt string for hashing purposes.

Note: The output string can be in raw bytes of the $printable parameter is set to true.

Parameters

integer $length

The desired output length (default => 16).

boolean|integer $printable

Flag for using only printable characters instead of bytes (default => true).

Returns

string —

Randomly generated hashing salt.