Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 5, 2024 via pnpm

hasha 5.2.2

Hashing made simple. Get the hash of a buffer/string/stream/file.
Package summary
Share
0
issues
2
licenses
2
MIT
1
(MIT OR CC0-1.0)
Package created
23 May 2015
Version published
9 Oct 2020
Maintainers
1
Total deps
3
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
hasha@5.2.2
is-stream@2.0.1

(MIT OR CC0-1.0)

Public Domain
1 Packages, Including:
type-fest@0.8.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of hasha 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
is-stream2.0.12.17 kBMIT
prod
type-fest0.8.121.46 kB(MIT OR CC0-1.0)
prod

Visualizations

Frequently Asked Questions

What does hasha do?

Hasha is a convenient, user-friendly wrapper for the core 'crypto' Hash class in Node.js, offering a simpler API and superior default settings for hashing processes. Perfect for generating cryptographic hash values from a buffer, string, stream, or file, Hasha utilises best-practice defaults in its operations.

How do you use hasha?

Hasha is versatile, easy to use and can be installed using npm:

$ npm install hasha

Once installed, you can use Hasha to hash a string or a buffer like so:

const hasha = require('hasha');

hasha('unicorn');
//=> 'e233b19aabc7d5e53826fb734d1222f1f0444c3a3fc67ff4af370a66e7cadd2cb24009f1bc86f0bed12ca5fcb226145ad10fc5f650f6ef0959f8aadc5a594b27'

For asynchronous operations, use hasha.async:

const hasha = require('hasha');

(async () => {
	console.log(await hasha.async('unicorn'));
	//=> 'e233b19aabc7d5e53826fb734d1222f1f0444c3a3fc67ff4af370a66e7cadd2cb24009f1bc86f0bed12ca5fcb226145ad10fc5f650f6ef0959f8aadc5a594b27'
})();

To hash a file, you can use hasha.fromFile:

const hasha = require('hasha');
(async () => {
	// Get the MD5 hash of an image
	const hash = await hasha.fromFile('unicorn.png', {algorithm: 'md5'});
	console.log(hash);
	//=> '1abcb33beeb811dca15f0ac3e47b88d9'
})();

Where are the hasha docs?

The most comprehensive documentation for Hasha can be found on the Node.js crypto API documentation page: https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options. Here you'll find details about hashing and the options you can use in Hasha's methods. You can also refer to the GitHub repository here for additional details.