I have a string that I want to hash. What\'s the easiest way to generate the hash in node.js?
The hash is for versioning, not security.
The crypto module makes this very easy.
crypto
Setup:
// import crypto from 'crypto'; const crypto = require('crypto'); const sha256 = x => crypto.createHash('sha256').update(x, 'utf8').digest('hex');
Usage:
sha256('Hello, world. ');