Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Jun 2, 2024 via pnpm

hasha 2.0.0

Hashing made simple. Get the hash of a buffer/string/stream/file.
Package summary
Share
0
issues
1
license
4
MIT
Package created
23 May 2015
Version published
1 Sep 2015
Maintainers
1
Total deps
4
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
4 Packages, Including:
hasha@2.0.0
is-stream@1.1.0
pinkie-promise@1.0.0
pinkie@1.0.0
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-stream1.1.01.58 kBMIT
prod
pinkie-promise1.0.02.04 kBMIT
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.