SeaSalt_Hashing


SeaSalt_Hashing

Requires the Sodium Sumo distribution

Constructor

new SeaSalt_Hashing(stringopt, hashopt, formatopt)

Parameters
string:string (optional)

String to hash

hash:string (optional)

Hashing algorithm to use

format:string (optional)

Output format of the hash data (hex, binary, base64)

Methods

sha256(string, formatopt):binary|string

Parameters
string:string

String to hash

format:string (optional)

Output format of the hash data (hex, binary, base64)

Returns
Type
:binary|string

Returns in the requested format.

Example
let hash = new SeaSalt_Hashing();
hash.sha256('testing')

//  returns a string like: cf80cd8aed482d5d1527d7dc72fceff84e6326592848447d2dc0b0e87dfc9a90

sha512(string, formatopt):binary|string

Parameters
string:string

String to hash

format:string (optional)

Output format of the hash data (hex, binary, base64)

Returns
Type
:binary|string

Returns in the requested format.

Example
let hash = new SeaSalt_Hashing();
hash.sha512('testing')

//  returns a string like: 521b9ccefbcd14d179e7a1bb877752870a6d620938b28a66a107eac6e6805b9d0989f45b5730508041aa5e710847d439ea74cd312c9355f1f2dae08d40e41d50

toString():string

Returns the hash result in hex format.

Returns
Type
:string