Socket
Socket
Sign inDemoInstall

js-sha1

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

LICENSE.txt

4

CHANGELOG.md

@@ -0,3 +1,7 @@

# v0.1.1 / 2014-01-05
Update license
# v0.1.0 / 2014-01-04
Initial release

9

package.json
{
"name": "js-sha1",
"version": "0.1.0",
"version": "0.1.1",
"description": "A simple SHA1 hash function for JavaScript supports UTF-8 encoding.",

@@ -14,6 +14,9 @@ "main": "src/sha1.js",

"keywords": [
"sha",
"sha1",
"hash",
"encryption"
"encryption",
"cryptography",
"HMAC"
],
"license": "MIT",
"author": "emn178 <emn178@gmail.com>",

@@ -20,0 +23,0 @@ "homepage": "https://github.com/emn178/js-sha1",

@@ -11,15 +11,16 @@ # js-sha1

If you use node.js, you should require the module first:
var sha1 = require('js-sha1');
```JavaScript
sha1 = require('js-sha1');
```
And you could use like this:
sha1('Message to hash');
```JavaScript
sha1('Message to hash');
```
## Example
Code
sha1('');
sha1('The quick brown fox jumps over the lazy dog');
sha1('The quick brown fox jumps over the lazy dog.');
```JavaScript
sha1('');
sha1('The quick brown fox jumps over the lazy dog');
sha1('The quick brown fox jumps over the lazy dog.');
```
Output

@@ -31,7 +32,8 @@

It also support UTF-8 encoding:
It also supports UTF-8 encoding:
Code
sha1('中文');
```JavaScript
sha1('中文');
```
Output

@@ -42,6 +44,10 @@

## Tests
You can open `tests/index.html` in browser or use node.js to run `node tests/node-test.js` for test.
You can open `tests/index.html` in browser or use node.js to run test
You also could use `npm test` instance of `node tests/node-test.js`.
node tests/node-test.js
or
npm test
## Extensions

@@ -52,7 +58,9 @@ ### jQuery

Code
jQuery.sha1 = sha1
```JavaScript
jQuery.sha1 = sha1
```
And then you could use like this:
$.sha1('message');
```JavaScript
$.sha1('message');
```
### Prototype

@@ -62,12 +70,16 @@ If you prefer prototype style, you can add following code to add a prototype extension.

Code
String.prototype.sha1 = function() {
return sha1(this);
};
```JavaScript
String.prototype.sha1 = function() {
return sha1(this);
};
```
And then you could use like this:
```JavaScript
'message'.sha1();
```
## License
The project is released under the [MIT license](http://www.opensource.org/licenses/MIT).
'message'.sha1();
## Contact
The project's website is located at https://github.com/emn178/js-sha1
Author: emn178@gmail.com

@@ -0,1 +1,11 @@

/*
* js-sha1 v0.1.1
* https://github.com/emn178/js-sha1
*
* Copyright 2014, emn178@gmail.com
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/MIT
*/
(function(root, undefined){

@@ -2,0 +12,0 @@ 'use strict';

@@ -1,3 +0,3 @@

global.sha1 = require('../src/sha1.js');
sha1 = require('../src/sha1.js');
require('./debug.js');
require('./test.js');
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc