Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jssha

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jssha

jsSHA is a JavaScript implementation of the complete Secure Hash Standard family (SHA-1, SHA-224, SHA3-224, SHA-256, SHA3-256, SHA-384, SHA3-384, SHA-512, SHA3-512, SHAKE128, and SHAKE256) as well as HMAC

  • 2.4.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is jssha?

jsSHA is a JavaScript library that provides various cryptographic hash functions and HMAC (Hash-based Message Authentication Code) functionalities. It supports a wide range of hash algorithms including SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, SHA3-512, and SHAKE128/256.

What are jssha's main functionalities?

Hashing

This feature allows you to create a hash of a given input text using various algorithms. In this example, SHA-256 is used to hash the input text 'This is my input text' and the result is output in hexadecimal format.

const jsSHA = require('jssha');
const shaObj = new jsSHA('SHA-256', 'TEXT');
shaObj.update('This is my input text');
const hash = shaObj.getHash('HEX');
console.log(hash);

HMAC

This feature allows you to create an HMAC using a specified key and input text. In this example, SHA-256 is used to create an HMAC for the input text 'This is my input text' with the key 'my-secret-key', and the result is output in hexadecimal format.

const jsSHA = require('jssha');
const shaObj = new jsSHA('SHA-256', 'TEXT');
shaObj.setHMACKey('my-secret-key', 'TEXT');
shaObj.update('This is my input text');
const hmac = shaObj.getHMAC('HEX');
console.log(hmac);

SHAKE

This feature allows you to use the SHAKE (Secure Hash Algorithm Keccak) function, which is a variable-length hash function. In this example, SHAKE128 is used with an output length of 256 bits to hash the input text 'This is my input text', and the result is output in hexadecimal format.

const jsSHA = require('jssha');
const shaObj = new jsSHA('SHAKE128', 'TEXT', {shakeLen: 256});
shaObj.update('This is my input text');
const shake = shaObj.getHash('HEX');
console.log(shake);

Other packages similar to jssha

Keywords

FAQs

Package last updated on 08 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc