function scryptSync(
   _passwd, 
   _salt, 
   N, 
   r, 
   p, 
   dkLen): string

Provides a synchronous variant of scrypt.

This will completely lock up and freeze the UI in a browser and will prevent any event loop from progressing. For this reason, it is preferred to use the async variant.

Parameters

ParameterTypeDescription
_passwdBytesLikeThe password to use.
_saltBytesLikeThe salt to use.
NnumberThe CPU/memory cost parameter.
rnumberThe block size parameter.
pnumberThe parallelization parameter.
dkLennumberThe length of the key to generate.

Returns

string

The key derived from the password.

Example

// The password must be converted to bytes, and it is generally
// best practices to ensure the string has been normalized. Many
// formats explicitly indicate the normalization form to use.
password = 'hello';
passwordBytes = toUtf8Bytes(password, 'NFKC');

salt = id('some-salt');

// Compute the scrypt
scryptSync(passwordBytes, salt, 1024, 8, 1, 16);

Source

crypto/scrypt.ts:153