Help About Node.js

i trying to make a hash in bcrypt but im very noob whit that,always i try hash me a password word not a variable password any help whit that script,thanks.

BLOCK:ConstantString

LABEL:PASSWORD
value = $“input.PASS”
=> VAR @password
ENDBLOCK

BLOCK:Script
LABEL:BCRYPT
INTERPRETER:NodeJS
INPUT password
BEGIN SCRIPT
const bcrypt = require(‘bcrypt’);
// Generate Salt
const salt = bcrypt.genSaltSync(10);
// Hash Password
const hash = bcrypt.hashSync(‘password’, salt);
console.log(hash);
END SCRIPT
OUTPUT String @hash
ENDBLOCK

All you have to do is pass the variable directly. Such as

BLOCK:ConstantString

value = $"<input.PASSWORD>"

=> VAR @pass

ENDBLOCK

BLOCK:Script

LABEL:BCRYPT

INTERPRETER:NodeJS

INPUT pass

BEGIN SCRIPT

const bcrypt = require("bcrypt");

// Generate Salt

const salt = bcrypt.genSaltSync(10);

// Hash Password

const hash = bcrypt.hashSync(pass, salt);

console.log(hash);

END SCRIPT

OUTPUT String @hash

ENDBLOCK
2 Likes

@Pure Is there a module that needed to run script ?

yes its called bcrypt. Its the require part of the script

Many thanks for u help.

I smell a plug-in XD