crypto

Methods

(static) crypt(text, salt) → {string}

Source:

Securely hash a password using system's crypt function

Parameters:
Name Type Description
text string

The password to hash

salt string

The salt and hashing options

Throws:
Returns:

The hashed password

Type
string

(static) get_random_bytes(count) → {Uint8Array}

Source:

Get true random bytes (returned by the operating system RNG)

Parameters:
Name Type Description
count number

Number of bytes to return

Throws:
Returns:

A buffer with count true random bytes

Type
Uint8Array

(static) sha256(data) → {string|Uint8Array}

Source:

Compute SHA-256 hash for given data

Parameters:
Name Type Description
data string | Uint8Array

Data to digest. If a string is given, it is first encoded as UTF-8 bytes.

Returns:

Returns the hash of the given data. If a string is given as data, the return value is an hexadecimal representation of the hash.

Type
string | Uint8Array