Created
February 7, 2018 17:02
-
-
Save groovecoder/7fbb091b1c303a83107ea3674d17b44d to your computer and use it in GitHub Desktop.
This file contains hidden or 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 stdin = process.openStdin(); | |
| const shasum = crypto.createHash('sha1'); | |
| console.log('Enter an email address to get the SHA1 hash as it would appear in a HIBP hashset file.'); | |
| stdin.addListener('data', data => { | |
| let trimmedString = data.toString().trim(); | |
| console.log('You entered: [' + trimmedString + '], sha1 hash of lowercase: '); | |
| shasum.update(trimmedString.toLowerCase()); | |
| console.log(shasum.digest('hex')); | |
| console.log('Enter an email address to get the SHA1 hash as it would appear in a HIBP hashset file.'); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment