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

universal-hmac-sha256-js

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

universal-hmac-sha256-js

A universal JavaScript HMAC-SHA256 hashing algorithm (browsers + Node.js).

  • 3.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-55%
Maintainers
1
Weekly downloads
 
Created
Source

Universal-HMAC-SHA256-js

An optimised universal JavaScript (Browsers + Node.js) HMAC-SHA256 hashing algorithm.

  • Zero dependencies
  • 🤏 Small bundle impact (~400 bytes)

Setup

npm i universal-hmac-sha256-js

Node CJS.

const hmac_sha256 = import('universal-hmac-sha256-js/hmac-sha256-node.mjs')

Node ESM.

import hmac_sha256 from 'universal-hmac-sha256-js/hmac-sha256-node.mjs'

Deno.

import hmac_sha256 from 'https://deno.land/x/hmacsha256/hmac-sha256-deno.mjs'

API

function hmac_sha256

Performs a HMAC SHA256 hash.

ParameterTypeDescription
dataUint8ArrayData to hash.
keyUint8ArraySecret key.

Returns: Uint8Array — The HMAC-SHA256 data.

Examples

How to use.

const data = Uint8Array.from([104, 101, 108, 108, …])
const key =  Uint8Array.from([193, 208, 122, 108, …])

hmac_sha256(data, key).then(console.log)

The logged output is UintArray([43, …])

Keywords

FAQs

Package last updated on 28 Feb 2023

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