@aws-crypto/sha256-js
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@aws-crypto/util | 1.2.2 | 9.43 kB | Apache-2.0 | prod | |
@aws-sdk/types | 3.535.0 | 47.39 kB | Apache-2.0 | prod | |
tslib | 1.14.1 | 7.43 kB | 0BSD | prod |
The @aws-crypto/sha256-js is a pure JavaScript implementation of the SHA256 cryptographic hash function. Its functionality is based around providing a way to generate secure hash algorithms mostly for AWS computations, but can also be utilized in other contexts. SHA256 is a commonly used encryption process, and now it's brought to you in JavaScript courtesy of the Amazon Web Services team.
Using @aws-crypto/sha256-js involves creating a new instance of the Sha256 class and then calling methods on it to update the data you want to hash, and finally digest the data to produce your hashed result. Below are couple of code examples:
For hashing some data:
import {Sha256} from '@aws-crypto/sha256-js';
const hash = new Sha256();
hash.update('some data');
const result = await hash.digest();
For 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();
There doesn't seem to be a separate documentation site for @aws-crypto/sha256-js. The main source of information for this package is its README file on the GitHub repository. This provides brief details on what the package does and how to use it. You can access this information at GitHub repository for @aws-crypto/sha256-js.