Socket
Socket
Sign inDemoInstall

@aws-crypto/sha256-js

Package Overview
Dependencies
7
Maintainers
8
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aws-crypto/sha256-js

A pure JS implementation SHA256.


Version published
Maintainers
8
Install size
530 kB
Created

Package description

What is @aws-crypto/sha256-js?

The @aws-crypto/sha256-js package is a JavaScript implementation of the SHA-256 hash function. It is part of the AWS SDK for JavaScript and is used to compute SHA-256 cryptographic hash values. This package is particularly useful when working with AWS services that require SHA-256 hashes, such as signing requests for AWS Signature Version 4.

What are @aws-crypto/sha256-js's main functionalities?

Computing SHA-256 hash

This feature allows you to compute the SHA-256 hash of a given input. The code sample demonstrates how to create a new instance of the Sha256 class, update it with the data to be hashed, and then compute the digest.

const { Sha256 } = require('@aws-crypto/sha256-js');

async function computeHash(data) {
  const hash = new Sha256();
  hash.update(data);
  return hash.digest();
}

computeHash('data to hash').then(console.log);

Other packages similar to @aws-crypto/sha256-js

Changelog

Source

5.2.0 (2023-10-16)

Features

  • support ESM artifacts in all packages (#752) (e930ffb)

Readme

Source

crypto-sha256-js

A pure JS implementation SHA256.

Usage

  • To hash "some data"
import {Sha256} from '@aws-crypto/sha256-js';

const hash = new Sha256();
hash.update('some data');
const result = await hash.digest();

  • To hmac "some data" with "a key"
import {Sha256} from '@aws-crypto/sha256-js';

const hash = new Sha256('a key');
hash.update('some data');
const result = await hash.digest();

Test

npm test

FAQs

Last updated on 16 Oct 2023

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc