node js createHash
require("crypto")
.createHash("sha256")
.update("Man oh man do I love node!")
.digest("hex");
node js createHash
require("crypto")
.createHash("sha256")
.update("Man oh man do I love node!")
.digest("hex");
how to hash with crypto Node.js
//Hash something.
crypto = crypto || require('crypto');
const createHash = crypto.createHash;
function sha1(txt) {
return createHash('sha1') // <-- You can use other than sha1
.update(txt) //set what to encode
.digest('hex') //basically another way to encode. hex is base16 so for example doing .digest('base64') encodes 4x more effenciently
}
const hash = sha1('password');
hash == sha1('password')?'yes':'no'; //yes
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us