js-sha256 (2024)

0.11.0•Public•Published

js-sha256 (1)js-sha256 (2)js-sha256 (3)
js-sha256 (4)
A simple SHA-256 / SHA-224 hash function for JavaScript supports UTF-8 encoding.

Demo

SHA256 Online
SHA224 Online
SHA256 File Online
SHA225 File Online

Download

Compress
Uncompress

Installation

You can also install js-sha256 by using Bower.

bower install js-sha256

For node.js, you can use this command to install:

npm install js-sha256

Usage

You could use like this:

sha256('Message to hash');sha224('Message to hash');var hash = sha256.create();hash.update('Message to hash');hash.hex();var hash2 = sha256.update('Message to hash');hash2.update('Message2 to hash');hash2.array();// HMACsha256.hmac('key', 'Message to hash');sha224.hmac('key', 'Message to hash');var hash = sha256.hmac.create('key');hash.update('Message to hash');hash.hex();var hash2 = sha256.hmac.update('key', 'Message to hash');hash2.update('Message2 to hash');hash2.array();

Node.js

If you use node.js, you should require the module first:

var sha256 = require('js-sha256');

or

var sha256 = require('js-sha256').sha256;var sha224 = require('js-sha256').sha224;

or

const { sha256, sha224 } = require('js-sha256');

TypeScript

If you use TypeScript, you can import like this:

import { sha256, sha224 } from 'js-sha256';

RequireJS

It supports AMD:

require(['your/path/sha256.js'], function(sha256) {// ...});

Example

sha256(''); // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855sha256('The quick brown fox jumps over the lazy dog'); // d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592sha256('The quick brown fox jumps over the lazy dog.'); // ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6csha224(''); // d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42fsha224('The quick brown fox jumps over the lazy dog'); // 730e109bd7a8a32b1cb9d9a09aa2325d2430587ddbc0c38bad911525sha224('The quick brown fox jumps over the lazy dog.'); // 619cba8e8e05826e9b8c519c0a5c68f4fb653e8a3d8aa04bb2c8cd4c// It also supports UTF-8 encodingsha256('中文'); // 72726d8818f693066ceb69afa364218b692e62ea92b385782363780f47529c21sha224('中文'); // dfbab71afdf54388af4d55f8bd3de8c9b15e0eb916bf9125f4a959d4// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer` inputsha256([]); // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855sha256(new Uint8Array([211, 212])); // 182889f925ae4e5cc37118ded6ed87f7bdc7cab5ec5e78faef2e50048999473f// Different outputsha256(''); // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855sha256.hex(''); // e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855sha256.array(''); // [227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]sha256.digest(''); // [227, 176, 196, 66, 152, 252, 28, 20, 154, 251, 244, 200, 153, 111, 185, 36, 39, 174, 65, 228, 100, 155, 147, 76, 164, 149, 153, 27, 120, 82, 184, 85]sha256.arrayBuffer(''); // ArrayBuffer

Benchmark

jsPerf Benchmark

License

The project is released under the MIT license.

Contact

The project's website is located at https://github.com/emn178/js-sha256
Author: Chen, Yi-Cyuan ([email protected])

Package Sidebar

Install

npm i js-sha256

Weekly Downloads

1,608,889

Version

0.11.0

License

MIT

Unpacked Size

39.5 kB

Total Files

7

Last publish

Collaborators

  • js-sha256 (5)

js-sha256 (2024)
Top Articles
Does the FAA know when I fly my drone? 
What is Polkadex?
Katie Nickolaou Leaving
Jesus Calling December 1 2022
Teenbeautyfitness
Wfin Local News
Imbigswoo
Locate Td Bank Near Me
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
How Much Is Tj Maxx Starting Pay
Wildflower1967
U/Apprenhensive_You8924
Walmart Double Point Days 2022
Midlife Crisis F95Zone
St Maries Idaho Craigslist
Loves Employee Pay Stub
Vandymania Com Forums
Two Babies One Fox Full Comic Pdf
Wkow Weather Radar
Riversweeps Admin Login
Tire Plus Hunters Creek
Idle Skilling Ascension
Does Royal Honey Work For Erectile Dysfunction - SCOBES-AR
Craigslist Sf Garage Sales
Ghid depunere declarație unică
Advance Auto Parts Stock Price | AAP Stock Quote, News, and History | Markets Insider
Homewatch Caregivers Salary
Mrstryst
Indiana Jones 5 Showtimes Near Jamaica Multiplex Cinemas
Kokomo Mugshots Busted
Exploring TrippleThePotatoes: A Popular Game - Unblocked Hub
How to Get Into UCLA: Admissions Stats + Tips
Admissions - New York Conservatory for Dramatic Arts
Google Flights Orlando
Scarlet Maiden F95Zone
Cnp Tx Venmo
Emily Browning Fansite
Shoecarnival Com Careers
2024-09-13 | Iveda Solutions, Inc. Announces Reverse Stock Split to be Effective September 17, 2024; Publicly Traded Warrant Adjustment | NDAQ:IVDA | Press Release
Candise Yang Acupuncture
Squalicum Family Medicine
How To Get To Ultra Space Pixelmon
What is a lifetime maximum benefit? | healthinsurance.org
Rise Meadville Reviews
bot .com Project by super soph
Dlnet Deltanet
Missed Connections Dayton Ohio
Craigslist Anc Ak
Mike De Beer Twitter
Texas 4A Baseball
Varsity Competition Results 2022
Latest Posts
Article information

Author: Amb. Frankie Simonis

Last Updated:

Views: 6213

Rating: 4.6 / 5 (56 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Amb. Frankie Simonis

Birthday: 1998-02-19

Address: 64841 Delmar Isle, North Wiley, OR 74073

Phone: +17844167847676

Job: Forward IT Agent

Hobby: LARPing, Kitesurfing, Sewing, Digital arts, Sand art, Gardening, Dance

Introduction: My name is Amb. Frankie Simonis, I am a hilarious, enchanting, energetic, cooperative, innocent, cute, joyous person who loves writing and wants to share my knowledge and understanding with you.