• Stars
    star
    332
  • Rank 126,957 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple SHA1 hash function for JavaScript supports UTF-8 encoding.

js-sha1

Build Status Coverage Status
NPM
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(''); // da39a3ee5e6b4b0d3255bfef95601890afd80709
sha1('The quick brown fox jumps over the lazy dog'); // 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
sha1('The quick brown fox jumps over the lazy dog.'); // 408d94384216f890ff7a0c3528e8bed1e0b01621

// It also supports UTF-8 encoding
sha1('δΈ­ζ–‡'); // 7be2d2d20c106eee0836c9bc2b939890a78e8fb3

// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
sha1([]); // da39a3ee5e6b4b0d3255bfef95601890afd80709
sha1(new Uint8Array([])); // da39a3ee5e6b4b0d3255bfef95601890afd80709

// Different output
sha1(''); // da39a3ee5e6b4b0d3255bfef95601890afd80709
sha1.hex(''); // da39a3ee5e6b4b0d3255bfef95601890afd80709
sha1.array(''); // [218, 57, 163, 238, 94, 107, 75, 13, 50, 85, 191, 239, 149, 96, 24, 144, 175, 216, 7, 9]
sha1.digest(''); // [218, 57, 163, 238, 94, 107, 75, 13, 50, 85, 191, 239, 149, 96, 24, 144, 175, 216, 7, 9]
sha1.arrayBuffer(''); // 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 ([email protected])

More Repositories

1

js-sha256

A simple SHA-256 / SHA-224 hash function for JavaScript supports UTF-8 encoding.
JavaScript
852
star
2

js-md5

A simple MD5 hash function for JavaScript supports UTF-8 encoding.
JavaScript
771
star
3

online-tools

Online tools provides md2, md5, sha1, sha2, sha512, bas64, html encode / decode functions
HTML
728
star
4

chartjs-plugin-labels

Plugin for Chart.js to display percentage, value or label in Pie or Doughnut.
JavaScript
613
star
5

js-sha3

A simple SHA-3 / Keccak hash function for JavaScript supports UTF-8 encoding.
JavaScript
349
star
6

jquery-lazyload-any

A jQuery plugin provides a lazyload function for images, iframe or anything.
JavaScript
231
star
7

js-sha512

A simple SHA-512, SHA-384, SHA-512/224, SHA-512/256 hash functions for JavaScript supports UTF-8 encoding.
JavaScript
216
star
8

markdown

A markdown example shows how to write a markdown file.
108
star
9

angular2-chartjs

Chart.js component for Angular2
TypeScript
95
star
10

jquery-stickit

A jQuery plugin provides a sticky header, sidebar or else when scrolling.
JavaScript
76
star
11

hi-base64

A simple Base64 encode / decode function for JavaScript supports UTF-8 encoding.
JavaScript
71
star
12

hi-base32

A simple Base32(RFC 4648) encode / decode function for JavaScript supports UTF-8 encoding.
JavaScript
61
star
13

js-htmlencode

A simple HTML encode / decode function for JavaScript.
JavaScript
55
star
14

js-crc

Simple CRC checksum functions for JavaScript(CRC-16 and CRC-32).
JavaScript
33
star
15

solidity-optimize-name

Find a optimized name for method.
JavaScript
33
star
16

jquery-animations

A CSS3 animation framework based on jQuery providing an easy way to develop cross browser CSS3 animations.
JavaScript
30
star
17

jquery-animations-tile

A plugin of jQuery-animations that provides tile animations.
JavaScript
22
star
18

jquery-appear

A jQuery plugin provides appear and disappear events to do lazyload, infinite scroll or else effect.
JavaScript
16
star
19

color-sampler

A jQuery plugin provides color sampler function for Canvas.
JavaScript
15
star
20

js-throttle-debounce

A javascript prototype plugin provides throttle and debounce methods.
JavaScript
15
star
21

jquery-animations-spotlight

A plugin of jQuery-animations that provides spotlight animations.
JavaScript
13
star
22

js-md4

A simple MD4 hash function for JavaScript supports UTF-8 encoding.
JavaScript
9
star
23

angular-appear

An AngularJS plugin provides appear and disappear events to do infinite scroll or else effect.
6
star
24

angular2-justgage

JustGage component for Angular2
TypeScript
6
star
25

js-md2

A simple MD2 hash function for JavaScript supports UTF-8 encoding.
JavaScript
4
star
26

blog

emn178's blog.
4
star
27

zipacker

Zip and download files in client side.
JavaScript
3
star
28

rails-intl-tel-input

Integrate with intl-tel-input to provide international telephone numbers input and form helper.
JavaScript
2
star
29

jquery-mscroll

A jQuery plugin enables to force to fire scroll event in mobile devices.
JavaScript
2
star
30

angular2-chartjs-sample

TypeScript
2
star
31

angular-marquee

An angular plugin provides marquee message.
2
star
32

sendcloud-mailer

An Action Mailer delivery method for SendCloud email service.
Ruby
2
star
33

sms_carrier

SMS Carrier is a framework for designing SMS service layers.
Ruby
2
star
34

devise_mobile_confirmable

It adds support to devise for confirming users' mobile by SMS.
Ruby
2
star
35

tem

1
star
36

Chart.Crosshairs.js

Crosshairs plugin for Chart.js.
JavaScript
1
star
37

chain-network

JavaScript
1
star
38

angular-bind-compile

An angular plugin provides bind html with compilation.
1
star
39

twilio-carrier

An sms_carrier delivery method for Twilio SMS service.
Ruby
1
star
40

chain-decoder

CSS
1
star
41

presenters

A simple presenter pattern for ruby. It also can work in rails.
Ruby
1
star
42

faye-jwt

A gem that provides authentication by JWT(json web token) with faye.
Ruby
1
star
43

flash-messenger

A jQuery plugin provides a simple flash messages and interface.
JavaScript
1
star
44

typescript-package-sample

Show you how to write a TypScript package.
TypeScript
1
star
45

fakesite-wechat

A fakesite plugin that provides a stub method for wechat. It's useful to bypass oauth flow in develpment environment.
Ruby
1
star