SeaSalt_PWHash_SCrypt


SeaSalt_PWHash_SCrypt

Creates a SCrypt hash of the provided password with optional security level.

Requires the Sodium Sumo distribution.

Constructor

new SeaSalt_PWHash_SCrypt()

Methods

create(password, securityopt):string

Parameters
password:string

Password to hash

security:string = normal (optional)

Security level to hash with

Returns
Type
:string

Returns the SCrypt hash of the supplied password.

Example
let scrypt = new SeaSalt_PWHash_SCrypt();
scrypt.create('myterriblepassword');

//  returns the scrypt string like: $7$C6....1....HnSL7MLPJo3Q3aJLYzzfP96kaFajuaoBuohB1HDKJ97$01YB7VEvx4jw2GLUATR46n4M6Ng7CmK2eLVLs4j8ZSC

verify(hash, password):boolean

Verify if a password matches an SCrypt hash.

Parameters
hash:string

SCrypt hash

password:string

User password

Returns
Type
:boolean
Example
//  using the example from scrypt.create
let scrypt = new SeaSalt_PWHash_SCrypt();
scrypt.verify('$7$C6....1....HnSL7MLPJo3Q3aJLYzzfP96kaFajuaoBuohB1HDKJ97$01YB7VEvx4jw2GLUATR46n4M6Ng7CmK2eLVLs4j8ZSC', 'myterriblepassword');