js-sha1
A simple SHA1 hash function for JavaScript supports UTF-8 encoding.
Demo
SHA1 Online
Download
Compress
Uncompress
Installation
You can also install js-sha1 by using Bower.
bower install js-sha1
For node.js, you can use this command to install:
npm install js-sha1
Usage
You could use like this:
sha1('Message to hash');
var hash = sha1.create();
hash.update('Message to hash');
hash.hex();
If you use node.js, you should require the module first:
sha1 = require('js-sha1');
It supports AMD:
require(['your/path/sha1.js'], function(sha1) {
});
Example
sha1('');
sha1('The quick brown fox jumps over the lazy dog');
sha1('The quick brown fox jumps over the lazy dog.');
sha1('中文');
sha1([]);
sha1(new Uint8Array([]));
sha1('');
sha1.hex('');
sha1.array('');
sha1.digest('');
sha1.arrayBuffer('');
License
The project is released under the MIT license.
Contact
The project's website is located at https://github.com/emn178/js-sha1
Author: Chen, Yi-Cyuan (emn178@gmail.com)