SHA-1 Hash Generator

Code Snippets
// using Node.js crypto
const crypto = require("crypto");

const message = "Hello World";

const hash = crypto.createHash("sha1")

console.log(`Computed hash of ${message}: ${hash}`);

The SHA-1 hash

The SHA-1 hash is a broken but widely used hashing algorithm developed by the United States government in 1995. Like most hashing functions, it takes an input of arbitrary bytes and performes a number of bitwise operations on those bytes to produce a unique digest.

It is an insecure algorithm not recommended for modern use, having been superseded by the SHA-2 algorithm family.


In 2017, Google and the Centrum Wiskunde & Informatica (CWI) announced what they called SHAttered, where they generated two different PDFs with the same SHA-1 digest. Until this point, SHA-1 was already on its way out, but no proven collision had yet been generated.

According to Google, this attack took "the equivalent processing power of 6,500 years of single-CPU computations and 110 years of single-GPU computations."