Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
The 'sha' npm package is used for generating SHA (Secure Hash Algorithm) hashes. It supports various SHA algorithms like SHA-1, SHA-256, SHA-384, and SHA-512. This package is useful for creating cryptographic hashes of data, which can be used for data integrity checks, password hashing, and more.
Generate SHA-1 Hash
This feature allows you to generate a SHA-1 hash of a given input string. The code sample demonstrates how to create a SHA-1 hash of the string 'Hello World' and output it in hexadecimal format.
const sha = require('sha');
const hash = sha('sha1').update('Hello World').digest('hex');
console.log(hash);
Generate SHA-256 Hash
This feature allows you to generate a SHA-256 hash of a given input string. The code sample demonstrates how to create a SHA-256 hash of the string 'Hello World' and output it in hexadecimal format.
const sha = require('sha');
const hash = sha('sha256').update('Hello World').digest('hex');
console.log(hash);
Generate SHA-384 Hash
This feature allows you to generate a SHA-384 hash of a given input string. The code sample demonstrates how to create a SHA-384 hash of the string 'Hello World' and output it in hexadecimal format.
const sha = require('sha');
const hash = sha('sha384').update('Hello World').digest('hex');
console.log(hash);
Generate SHA-512 Hash
This feature allows you to generate a SHA-512 hash of a given input string. The code sample demonstrates how to create a SHA-512 hash of the string 'Hello World' and output it in hexadecimal format.
const sha = require('sha');
const hash = sha('sha512').update('Hello World').digest('hex');
console.log(hash);
The 'crypto' module is a built-in Node.js module that provides cryptographic functionality, including a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions. It is more comprehensive and versatile compared to 'sha', supporting a wider range of cryptographic operations.
The 'hash.js' package is a JavaScript library that provides a simple way to create hash digests of data. It supports various hash algorithms including SHA-1, SHA-256, SHA-384, and SHA-512. It is similar to 'sha' but offers a more modular approach and additional features like HMAC.
The 'js-sha256' package is a JavaScript implementation of the SHA-256 hash function. It is lightweight and fast, making it suitable for client-side applications. Unlike 'sha', it focuses solely on SHA-256, providing a highly optimized implementation for this specific algorithm.
Check and get file hashes (using any algorithm)
$ npm install sha
Asynchronously check that fileName
has a "hash" of expected
. The callback will be called with either null
or an error (indicating that they did not match).
Options:
sha1
and can be any of the algorithms supported by crypto.createHash
Asynchronously get the "hash" of fileName
. The callback will be called with an optional error
object and the (lower cased) hex digest of the hash.
Options:
sha1
and can be any of the algorithms supported by crypto.createHash
BSD
FAQs
Check and get file hashes
The npm package sha receives a total of 140,852 weekly downloads. As such, sha popularity was classified as popular.
We found that sha demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.