jsSHA - A JavaScript implementation of the complete Secure Hash Standard family
        (SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512) as well as HMAC by Brian Turek

About
-------------------------
jsSHA is a javaScript implementation of the complete Secure Hash Algorithm family as defined
by FIPS PUB 180-2 (http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf).  It
also includes the HMAC algorithm with SHA support as defined by FIPS PUB 198a
(http://csrc.nist.gov/publications/fips/fips198/fips-198a.pdf)

With the slow phasing out of MD5 as the standard hash to use in web applications, a client-side
implementation of the complete Secure Hash Standard family was needed.  Due to SHA-384 and SHA-512's
use of 64-bit values throughout the algorithm, JavaScript can not easily natively support the calculation
of these hashes.  As a result, a bit of hacking had to be done to make sure the values behaved themselves.
SHA-224 was added to the Secure Hash Standard family on 25 February 2004 so it was also included in this
package.


Files
-------------------------
src/sha.js
The complete SHA implementation

src/sha1.js
A smaller/web friendly implementation of only SHA-1.

src/sha256.js
A smaller/web friendly implementation of only SHA-224 and SHA-256.

src/sha512.js
A smaller/web friendly implementation of only SHA-384 and SHA-512.

test/test.html
A test page that calculates various hashes and has their correct values.

test/HMACGen.py
A Python 3.X script that generates the correct HMAC hashes as the specification did not provide hashes for
algorithms other than SHA-1


Usage
-------------------------
Include the desired JavaScript file (sha.js, sha1.js, sha256.js, or sha512.js) in your header (sha.js used below):
<script type="text/javascript" src="/path/to/sha.js"></script>

Instantiate a new jsSHA object with your string to be hashed as the only parameter.  Then, call getHash with the desired
hash variant (SHA-1, SHA-224, SHA-256, SHA-384, or SHA-512) and output type (HEX or B64).  In the example below,
"This is a Test" and "SHA-512" were used as the string to be hashed and variant respectively.  Also, the HMAC using ASCII
key "SecretKey" and hashing algorithm SHA-512 was calculated.

var shaObj = new jsSHA("This is a Test", "ASCII");
var hash = shaObj.getHash("SHA-512", "HEX");
var hmac = shaObj.getHMAC("SecretKey", "ASCII", "SHA-512", "HEX");

NOTE: If you are using sha1.js, omit the SHA variant parameter as there is only one option.

Contact Info
-------------------------
The project's website is located at http://jssha.sourceforge.net/
