GitXplorerGitXplorer
j

tiny-hashes

public
118 stars
19 forks
1 issues

Commits

List of commits on branch master.
Unverified
da474a6f92843117a423dcd28755ebebdfb57234

Merge remote-tracking branch 'heavensrevenge/master'

jjbt committed 10 years ago
Unverified
588f4e6e2f32dc8482f233365f863bdb59eb1a3b

Bit of whitespace to make my linter happy

jjbt committed 10 years ago
Unverified
0ab32024934afd8ff3e31cd8cf152c1c88b24710

Refactored out the add function from md5.js and sha256.js, put a few "strategically placed" |0's. Passes all tests in test.js

hheavensrevenge committed 10 years ago
Unverified
15d7e899d63619d4e84e3bddcf9e8c5e6bcfd24d

Removed the variable "sixteen" from md5.js and sha256.js

hheavensrevenge committed 10 years ago
Unverified
6ee5e3b99605189105c5e786835771c2b1f2f7fe

Changed function form of calcMD5

hheavensrevenge committed 10 years ago
Unverified
0e0a1bca031c32aefe7ec4b4cf9a9fa2e2647d7a

Update makefile to include closure etc; tweak tests a lot

jjbt committed 11 years ago

README

The README file for this repository.

Tiny Hash Functions

Some super-tiny implementations of common hash functions (MD5, SHA-1 and SHA-256).

Installation

From npm:

npm i tiny-hashes

Usage

Preferably using ES modules:

import md5 from 'tiny-hashes/md5';
import sha1 from 'tiny-hashes/sha1';
import sha256 from 'tiny-hashes/sha256';

md5('hello, world'); // "e4d7f1b4ed2e42d15898f4b27b019da4", hopefully

sha1('hello, world'); // "b7e23ec29af22b0b4e41da31e868d57226121c84", hopefully

sha256('hello, world'); // "09ca7e4eaa6e8ae9c7d261167129184883644d07dfba7cbfbc4c8a2e08360d5b", hopefully

Other ways of importing

The following styles should also all work, but may be less-friendly to tree-shaking:

const md5 = require('tiny-hashes/md5');
const sha1 = require('tiny-hashes/sha1');
const sha256 = require('tiny-hashes/sha256');

import { md5, sha1, sha256 } from 'tiny-hashes';

const { md5, sha1, sha256 } = require('tiny-hashes');

When should you use this?

Please don't use this if you absolutely rely on it being correct. There are more solid solutions out there.

Please also don't use this server-side in Node.js - the crypto build-in module exists for a reason.

Basically only use this if you want a super-duper-tiny hash function in the browser that you can be about 99% sure is correct and should always be self-consistent.