JavaScript SHA-1
A hash function in the browser, April 2001
A JavaScript port of the SHA-1 hash, published in April 2001, before its collision weaknesses were known.
Source My Planet Source Code archive (2000s)
Executive summary
Why it exists
The function makes a 160-bit digest, 40 hex digits, from a message of any length, and in 2001 there was little hashing code for the browser.
Outcome
Years later, while contracting at a company, I found my own code in their commercial codebase with someone's SHA-256 additions on top. I told them. They checked their history, confirmed it predated me, and announced it to every team.
My role
Author.
Technical overview
How it works
A JavaScript port of SHA-1 that I published in April 2001.