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

hash.js

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash.js

Various hash functions that could be run by both browser and node

  • 0.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.7M
decreased by-62.84%
Maintainers
1
Weekly downloads
 
Created

What is hash.js?

The hash.js npm package is a JavaScript library that provides a collection of cryptographic hash functions implemented in pure JavaScript. It is commonly used for creating hash digests of data, which is a crucial aspect of various security protocols and data integrity checks.

What are hash.js's main functionalities?

SHA-1 Hashing

This feature allows you to create SHA-1 hash digests of input data. The code sample demonstrates how to hash the string 'Hello World' using SHA-1 and output the digest in hexadecimal format.

"use strict"; const hash = require('hash.js'); const sha1Hash = hash.sha1().update('Hello World').digest('hex'); console.log(sha1Hash);

SHA-256 Hashing

This feature enables SHA-256 hashing. The code sample shows how to hash the string 'Hello World' using SHA-256 and then output the digest in hexadecimal format.

"use strict"; const hash = require('hash.js'); const sha256Hash = hash.sha256().update('Hello World').digest('hex'); console.log(sha256Hash);

HMAC Generation

This feature is used to generate HMAC (Hash-based Message Authentication Code) using a specified hash function and a secret key. The code sample illustrates generating an HMAC for the string 'Hello World' using the SHA-256 hash function and 'secret-key' as the secret key.

"use strict"; const hash = require('hash.js'); const hmac = hash.hmac(hash.sha256, 'secret-key').update('Hello World').digest('hex'); console.log(hmac);

Other packages similar to hash.js

Keywords

FAQs

Package last updated on 31 Aug 2014

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