Michael Bradley, Jr. - Hash-0.01

Documentation | Source

Name

Hash - provides MD5 and SHA-256 cryptographic hash routines, implemented as static methods within Joose3 classes.

The module is uesable both server-side with node.js and in a browser environment.

SYNOPSIS

Node.js example:

    require('hash')

    // define some text you wish to hash

    var text = 'Some amazing text.'

    // hash it using the MD5 routine

    var hash = Hash.MD5.hash(text) // => '8dc6e489042b35c41f38319f1702e829'

    // or the same text can be hashed with the SHA-256 routine

    hash2 = Hash.SHA256.my.hash(text) => 'b291f7ca30c306cc5e96ce8b046e5656c05b7621eb848ed4b180fb3b25b19d8d'

DESCRIPTION

Hash is a small collection of Joose3 classes which provide cryptographic hash routines for string types, implemented as static methods.

METHODS

Presently the MD5 and SHA-256 routines are available as static methods in the Hash.MD5 and Hash.SHA256 classes:

    Hash.MD5.hash('text')

and Hash.SHA256.hash('text')

It should be noted that the MD5.hash() method is a good deal less CPU intensive than the SHA256.hash() method. Keep that in mind if your going to be hashing message payloads in a high-throughput scenario where latency is a concern.

NOTE: if you intend to hash over JSON objects, remember that key order is not guaranteed, and therefore it's not sufficient to JSON.stringify() an object -- you would need first to serialize the object and any child objects into a collection of arrays, sorted lexographically (recursively) by key name.

GETTING HELP

This extension is supported via github issues tracker: http://github.com/michaelsbradleyjr/Hash/issues

For general Joose questions you can also visit #joose on irc.freenode.org or mailing list at: http://groups.google.com/group/joose-js

SEE ALSO

Web page of this module: http://github.com/michaelsbradleyjr/Hash/

General documentation for Joose: http://openjsan.org/go/?l=Joose

BUGS

All complex software has bugs lurking in it, and this module is no exception.

Please report any bugs through the web interface at http://github.com/michaelsbradleyjr/Hash/issues

AUTHORS

Michael Bradley, Jr. michaelsbradleyjr@gmail.com

COPYRIGHT AND LICENSE

This software is Copyright (c) 2010 by Michael Bradley, Jr..

This is free software, licensed under:

The MIT (X11) License