Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Jun 1, 2024 via pnpm

sha.js 2.4.11

Streamable SHA hashes in pure javascript
Package summary
Share
0
issues
3
licenses
1
ISC
1
MIT
1
(MIT AND BSD-3-Clause)
Package created
27 Dec 2013
Version published
20 Mar 2018
Maintainers
3
Total deps
3
Direct deps
2
License
(MIT AND BSD-3-Clause)

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
inherits@2.0.4

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
1 Packages, Including:
safe-buffer@5.2.1

(MIT AND BSD-3-Clause)

Permissive
1 Packages, Including:
sha.js@2.4.11
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 sha.js 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
inherits2.0.41.98 kBISC
prod
safe-buffer5.2.19.74 kBMIT
prod

Visualizations

Frequently Asked Questions

What does sha.js do?

Sha.js is a node-style, pure JavaScript implementation of the Secure Hash Algorithm (SHA). It provides streamable SHA hashes, allowing for incremental updates and enabling it to easily handle data larger than your available memory. Please note that some older versions of the algorithm, SHA-0 and SHA-1, are now considered to be legacy and their use in new systems is discouraged. However, sha.js also supports SHA-224, SHA-256, SHA-384, and SHA-512, catering for the needs of modern applications.

How do you use sha.js?

To use sha.js, you first need to import it into your project. You can do so by using the require function which is built into Node.js. Once you have imported sha.js, you can call it with the name of the hashing algorithm you wish to use, update it with the data you want to hash and then produce the hash with the digest method. Here is an example:

var shajs = require('sha.js')

console.log(shajs('sha256').update('42').digest('hex')) 
// this will output: 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049

In this example, 'sha256' is the hashing algorithm being used, '42' is the data being hashed, and 'hex' is the format of the resulting hash. Sha.js can also be used in a more object-oriented style. Here is an example of that:

console.log(new shajs.sha256().update('42').digest('hex')) 
// this will output the same hex string hash as in the previous example

Where are the sha.js docs?

The documentation for sha.js does not appear to be hosted on a separate webpage. Instead, users are directed to the library's GitHub page at https://github.com/crypto-browserify/sha.js for more information. This readme file itself includes details on basic usage and supported hashing algorithms, as well as disclosing that it does not itself actually implement a stream. For those looking for a streamable interface, the readme suggests that it would be trivial to wrap sha.js in a stream. It also credits the work from which sha.js is derived and provides licensing details.