March 28, 2021
You don't need to install external packages to hash a string using the SHA-1 hashing method.
Node.js comes with a built-in package called crypto
that you can use. Here's a simple way:
const crypto = require('crypto')
const str = 'This is the string I want to hash.'
const hash = crypto.createHash('sha1').update(str).digest('hex')
The resulting hash
is str
, hashed using SHA-1 to create a shorter string that is fairly unique to the original string.
Tufts Meal Plan Wrapped
Mar 2, 2024
Building an e-ink picture frame that displays an iCloud photo album
Jan 9, 2024
2023 in review
Jan 5, 2024
Subscribe to my newsletter for a monthly round-up of new blog posts and projects Iām working on!