Last active
July 30, 2021 04:30
-
-
Save gabalafou/0fe4f144bcfb37c4b2ef156a428e8652 to your computer and use it in GitHub Desktop.
NodeJS: Generating a hard-to-guess password using a master password via HMAC-SHA1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto"); | |
const masterPassword = "opensesame"; | |
const siteTag = "google.com"; | |
const generatedPassword = crypto.createHmac("sha1", masterPassword).update(siteTag).digest("base64"); | |
console.log(generatedPassword); | |
// Expected result: lr+ErV3uFsDPkep/Th7Xqva8Z4M= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment