const argon = require('argon2')
async function hashpassword(password){
return argon.hash(password)
}
hashpassword("muzaif")
.then(hash => console.log(hash))
.catch(err => console.error("Error hashing password:", err));
async function verifypassword(password, hash){
return argon.verify(hash, password)
}
throw new TypeError('pchstr must be a non-empty string');
^
TypeError: pchstr must be a non-empty string
at deserialize (/home/trilochan-sashank/Desktop/Demo/node_modules/@phc/format/index.js:143:11)
at Object.verify (/home/trilochan-sashank/Desktop/Demo/node_modules/argon2/argon2.cjs:166:27)
at verifypassword (/home/trilochan-sashank/Desktop/Demo/app.js:38:16)
at Object. (/home/trilochan-sashank/Desktop/Demo/app.js:41:1)
at Module._compile (node:internal/modules/cjs/loader
at Object..js (node:internal/modules/cjs/loader
at Module.load (node:internal/modules/cjs/loader
at Module._load (node:internal/modules/cjs/loader
at TracingChannel.traceSync (node:diagnostics_channel:328:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:245:24)
Node.js v24.13.1
[Done] exited with code=1 in 0.105 seconds
Подробнее здесь: https://stackoverflow.com/questions/799 ... s-error-ho
Мобильная версия