Create a new Scrypt hash driver instance
Configuration options for the Scrypt hasher
Check if the value is a valid hash. This method just checks for the formatting of the hash.
scrypt.isValidHash('hello world') // false
scrypt.isValidHash('$scrypt$n=16384,r=8,p=1$iILKD1gVSx6bqualYqyLBQ$DNzIISdmTQS6sFdQ1tJ3UCZ7Uun4uGHNjj0x8FHOqB0pf2LYsu9Xaj5MFhHg21qBz8l5q/oxpeV+ZkgTAj+OzQ')
The value to check
True if the value is a valid Scrypt hash format
Hash a plain text value
const hash = await scrypt.make('password')
The plain text value to hash
Promise resolving to the Scrypt hash
Verify the plain text value against an existing hash
if (await scrypt.verify(hash, plainText)) {
}
The hashed value to verify against
The plain text value to verify
Promise resolving to true if verification succeeds
Find if the hash value needs a rehash or not. The rehash is required when.
const isValid = await scrypt.verify(hash, plainText)
// Plain password is valid and hash needs a rehash
if (isValid && await scrypt.needsReHash(hash)) {
const newHash = await scrypt.make(plainText)
}
The hashed value to check
True if the hash needs to be rehashed
Hash driver built on top of "scrypt" hash algorigthm. Under the hood we make use of the Node.js crypto module
The Scrypt implementation uses the PHC formatting for creating and verifying hashes.