Class: Hasher

Hasher

new Hasher()

Source:

Methods

(static) generateHash(seedSHA, salt, iterations) → {string}

Function to obtain a url-safe base64-encoded key-stretched hash of the seed and the salt using the PBKDF2-HMAC-SHA256 algorithm. Both the "seed" and the "salt" are encoded to SHA256 before feeding into the algorithm.

Parameters:
Name Type Description
seedSHA string The SHA256-encoded seed password.
salt string The input salt.
iterations int The number of PBKDF2 iterations.
Source:
Returns:
The proxy password hash object generated by PBKDF2 encoded in base64.
Type
string

(static) generateSalt() → {string}

Properties:
Name Type Description
domain string The website domain.
saltKey string The "key" used to strengthen the salt.
iterations int The number of PBKDF2 iterations.
Source:
Returns:
The generated "strengthened" salt, encoded in base64. A base64 encoding is chosen since it has characters from the set [A-Z][a-z][0-9](+,/), which looks like "mangled" text.
Type
string

(static) getPasswdStr(b64Hash, truncation) → {string}

Function to return the final password string from the base64-encoded proxy password, by replacing trailing "="s, and converting the encoding to "urlsafe" as per RFC 4648.

Parameters:
Name Type Description
b64Hash string The PBKDF2 hash encoded in base64.
truncation int The number of characters to truncate to. If this is negative, no truncation will be performed.
Source:
Returns:
The final password string.
Type
string