// using Node.js crypto
const crypto = require("crypto");
const message = "Hello World";
const hash = crypto.createHash("sha256")
.update(message)
.digest("hex");
console.log(`Computed hash of ${message}: ${hash}`);
SHA-256 is part of the SHA-2 hash algorithm family. It is a hash function that takes an arbitrary inputs of bytes and produces a 32 byte output (256 bit). This algorithm, along with SHA-512, are used extensively thoughout the internet, government applications, operating systems, and almost every area of modern life.
After the weaknesses of the SHA-1 algorithm was exposed, the NSA began developing the SHA-2 family of hashing functions.