Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 19, 2024 via pnpm

bcrypt 5.1.1

A bcrypt library for NodeJS.
Package summary
Share
1
issue
1
high severity
meta
1
5
licenses
28
ISC
27
MIT
1
BSD-3-Clause
2
other licenses
Apache-2.0
1
BSD-2-Clause
1
Package created
21 Feb 2011
Version published
16 Aug 2023
Maintainers
5
Total deps
58
Direct deps
2
License
MIT

Issues

1

1 high severity issue

high
via: bcrypt@5.1.1
Collapse
Expand

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
28 Packages, Including:
abbrev@1.1.1
aproba@2.0.0
are-we-there-yet@2.0.0
chownr@2.0.0
color-support@1.1.3
console-control-strings@1.1.0
fs-minipass@2.1.0
fs.realpath@1.0.0
gauge@3.0.2
glob@7.2.3
has-unicode@2.0.1
inflight@1.0.6
inherits@2.0.4
minimatch@3.1.2
minipass@3.3.6
minipass@5.0.0
nopt@5.0.0
npmlog@5.0.1
once@1.4.0
rimraf@3.0.2
semver@6.3.1
semver@7.6.2
set-blocking@2.0.0
signal-exit@3.0.7
tar@6.2.1
wide-align@1.1.5
wrappy@1.0.2
yallist@4.0.0

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
27 Packages, Including:
agent-base@6.0.2
ansi-regex@5.0.1
balanced-match@1.0.2
bcrypt@5.1.1
brace-expansion@1.1.11
concat-map@0.0.1
debug@4.3.4
delegates@1.0.0
emoji-regex@8.0.0
https-proxy-agent@5.0.1
is-fullwidth-code-point@3.0.0
make-dir@3.1.0
minizlib@2.1.2
mkdirp@1.0.4
ms@2.1.2
node-addon-api@5.1.0
node-fetch@2.7.0
object-assign@4.1.1
path-is-absolute@1.0.1
readable-stream@3.6.2
safe-buffer@5.2.1
string-width@4.2.3
string_decoder@1.3.0
strip-ansi@6.0.1
tr46@0.0.3
util-deprecate@1.0.2
whatwg-url@5.0.0

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
@mapbox/node-pre-gyp@1.0.11

Apache License 2.0

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
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
detect-libc@2.0.3

BSD 2-Clause "Simplified" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
webidl-conversions@3.0.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 bcrypt 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@mapbox/node-pre-gyp1.0.111 BBSD-3-Clause
prod
node-addon-api5.1.056.81 kBMIT
prod

Visualizations

Frequently Asked Questions

What does bcrypt do?

bcrypt is a robust and secure libary for NodeJS that is inherently designed to hash passwords. The bcrypt algorithm is incredibly secure and defends against rainbow table attacks by incorporating a salt, which is a random value unique to every hashed password. This unique attribute renders pre-computed hash attacks impractical by exponentially increasing the storage requirements of such mechanisms. It employs an adaptive hashing scheme, meaning that as computing power increases over time, the numberof iterations, or "rounds", of the algorithm can be increased to ensure your data remains secure.

How do you use bcrypt?

One can use bcrypt to hash and verify passwords in Node.js applications. After installing bcrypt via npm using "npm install bcrypt", you can generate a password hash using the module’s "genSalt" and "hash" methods, or by simply calling "hash". Here's an example of how you can hash a password:

const bcrypt = require('bcrypt');
const saltRounds = 10;
const myPlaintextPassword = 's0/\/\P4$$w0rD';

bcrypt.genSalt(saltRounds, (err, salt) => {
    bcrypt.hash(myPlaintextPassword, salt, (err, hash) => {
        // At this point, store the hash value in your password DB
    });
});

An alternative technique, which auto-generates a salt and hash, can also be used:

bcrypt.hash(myPlaintextPassword, saltRounds, (err, hash) => {
    // Store hash in your password DB.
});

To verify a password, compare the hash of the attempted password with the hash of the actual password using bcrypt’s "compare" function:

// Load hash from your password DB.
bcrypt.compare(myPlaintextPassword, hash, (err, result) => {
    if (result) {
        // If the password matches, result will be true.
    }
});

Bcrypt also supports promises if you prefer not to use callbacks. Async/await syntax works as well:

async function checkUser(username, password) {
    // Fetch user from a database, etc.

    const match = await bcrypt.compare(password, user.passwordHash);

    if (match) {
        // Login the user
    }
}

Where are the bcrypt docs?

The comprehensive documentation, which includes thorough instructions and code samples, for the bcrypt library can be found at its GitHub repository, accessible via the following URL: https://github.com/kelektiv/node.bcrypt.js. The documentation will guide you through all aspects of using the library, including installation, usage, detailed API reference, and more.