I want to hash passwords using Scrypt for that; I want to use this [package].(Scrypt-js NPM | npm.io)
Here is my code
import 'scrypt-js';
const N = 1024, r = 8, p = 1;
const dkLen = 32;
const password = new buffer.SlowBuffer("123456".normalize('NFKC'));
const salt = new buffer.SlowBuffer("[email protected]".normalize('NFKC'));
var t = scrypt.syncScrypt(password,salt,N,r,p,dkLen);
console.log(t);
And here is my log
I’m having this error
Uncaught ReferenceError ReferenceError: buffer is not defined
at <anonymous> (g:\m.stepn.com\test.js:4:18)
at run (internal/modules/esm/module_job:193:25)
--- await ---
at processTicksAndRejections (internal/process/task_queues:95:5)
--- await ---
at runMainESM (internal/modules/run_main:55:21)
at executeUserEntryPoint (internal/modules/run_main:78:5)
at <anonymous> (internal/main/run_main_module:17:47)
anybody know how to solve it I’m new in Javascript
BLOCK:Script
LABEL:HEX
INTERPRETER:NodeJS
INPUT key,salt
BEGIN SCRIPT
var scrypt = require('scryptsy');
var key = (key);
var salt = (salt);
var hash = scrypt(key, salt, 1024, 8, 1, 32);
var hashed = (hash.toString('hex'));
END SCRIPT
OUTPUT String @hashed
ENDBLOCK