Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Some tiny hash functions in javascript

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 Makefile
Octocat-spinner-32 README.md
Octocat-spinner-32 md5-min.js
Octocat-spinner-32 md5.js
Octocat-spinner-32 sha1-min.js
Octocat-spinner-32 sha1.js
Octocat-spinner-32 sha256-min.js
Octocat-spinner-32 sha256.js
Octocat-spinner-32 test.js
README.md

JavaScript Hash Functions

Some JavaScript implementations of common hash functions (MD5, SHA-1 and SHA-256) designed to be compressed into the smallest size possible.

I can't entirely guarantee that they'll absolutely always work exactly as they should, so it's probably not the best idea to use them in anything absolutely mission-critical. That said, they do seem to work fine for me wherever I use them. And if you do find something wrong, open an issue on GitHub and I'll do my best to fix it.

Licence and Usage

These scripts are licensed under the ☺ licence, so basically you're free to use them however you please - feel free to use or modify them in whatever way you like. You don't have to explicitly credit me (but if you do then I won't complain), but just don't pass them off as entirely your own, ok? That's just not cool.

But Why?

To begin with, because I needed a smallish MD5 that wasn't poorly written (lots of the others out there leaked globals), but nowadays it's pretty much just because I can.

And How?

Well, I started out with a mashup of the pseudocode on the respective wikipedia pages for the functions along with helper functions I found somewhere on the internet for converting strings to byte arrays etc, then bashed them every which-way I could with functionally-equivalent rearrangements to make the size smaller however I could think. Just don't try to get me to explain what any of it does any more.

Shout out to [RyanC][//github.com/ryancdotorg] for spotting a couple of bugs where I'd been a moron and over-optimised.

Something went wrong with that request. Please try again.