digest.js is a javascript library implementing cryptographic digest, HMAC algorithms and Password-based Key Derivation Function.
digest.js is designed for modern web browsers and requires the W3C Typed Arrays support. digest.js has been successfully tested with these web browsers:
Chrome 11
Firefox 4 (WARNING: since Firefox does not support the Dataview API, you should use the David Flanagan’s emulation)
Safari 5.1
Supported algorithms:
digest
MD5
SHA-1
SHA-256
Message Authentication Code (MAC)
HMAC/MD5
HMAC/SHA-1
HMAC/SHA-256
Password-Based Key Derivation Function (PBKDF)
PBKDF1/SHA1
PBKDF1/MD5
PBKDF2/HMAC/SHA1
PBKDF2/HMAC/SHA-256
API Usage
Digest
Initialize a digest object
1
vardg=newDigest.SHA1();
Update some data
123456
vardata=newArrayBuffer(3);varbuf=newUint8Array(data);buf[0]=0x61;/* a */buf[1]=0x62;/* b */buf[2]=0x63;/* c */dg.update(data);