
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
@aws-sdk/hash-blob-browser
Advanced tools
[](https://www.npmjs.com/package/@aws-sdk/hash-blob-browser) [](https://www.npmjs.com/package/@
@aws-sdk/hash-blob-browser is a package from the AWS SDK for JavaScript that provides utilities for computing cryptographic hashes of Blob objects in a browser environment. This is particularly useful for tasks such as data integrity checks, digital signatures, and other cryptographic operations.
Compute SHA-256 Hash
This feature allows you to compute the SHA-256 hash of a Blob object. The code sample demonstrates how to create a new Sha256 instance, update it with the Blob data, and then compute the digest.
const { Sha256 } = require('@aws-sdk/hash-blob-browser');
async function computeSHA256(blob) {
const hash = new Sha256();
hash.update(blob);
const digest = await hash.digest();
return digest;
}
// Usage example
const blob = new Blob(['Hello, world!']);
computeSHA256(blob).then(digest => console.log(digest));
Compute MD5 Hash
This feature allows you to compute the MD5 hash of a Blob object. The code sample demonstrates how to create a new Md5 instance, update it with the Blob data, and then compute the digest.
const { Md5 } = require('@aws-sdk/hash-blob-browser');
async function computeMD5(blob) {
const hash = new Md5();
hash.update(blob);
const digest = await hash.digest();
return digest;
}
// Usage example
const blob = new Blob(['Hello, world!']);
computeMD5(blob).then(digest => console.log(digest));
crypto-js is a widely-used library that provides a variety of cryptographic algorithms for JavaScript, including MD5, SHA-1, SHA-256, and more. Unlike @aws-sdk/hash-blob-browser, crypto-js is not specifically designed for Blob objects but can be used for general-purpose cryptographic operations.
js-sha256 is a lightweight library that provides a simple API for computing SHA-256 hashes in JavaScript. It is smaller and more focused than @aws-sdk/hash-blob-browser, making it a good choice for projects that only require SHA-256 hashing.
spark-md5 is a fast and efficient library for computing MD5 hashes in JavaScript. It is optimized for large files and can process data in chunks, making it a good alternative to @aws-sdk/hash-blob-browser for MD5 hashing.
3.374.0 (2023-07-20)
FAQs
[](https://www.npmjs.com/package/@aws-sdk/hash-blob-browser) [](https://www.npmjs.com/package/@
The npm package @aws-sdk/hash-blob-browser receives a total of 362,907 weekly downloads. As such, @aws-sdk/hash-blob-browser popularity was classified as popular.
We found that @aws-sdk/hash-blob-browser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.