Why you should use BCrypt to hash passwords (2024)

In the online world, passwords play a critical role in keeping your data and other important information safe. For this reason, ensuring your passwords remain secure is critical. If not, the consequences can be catastrophic — think the Sony hacks of 2011.

Many password solutions simply are not good enough and put your data and resources at risk. Let’s take a look at a few examples.

Plain text passwords

As its name infers, a plain text password makes use of only letters. Should a hacker gain access to passwords such as these, they can easily pose as a user on your system. Often, plain text passwords are replicated across other logins as well, as users don’t want to have to remember multiple passwords for different sites or applications. Guess what? That just gives a hacker access to those applications as well.

One way hash

With a one-way hash password, a server does not store plain text passwords to authenticate a user. Here, a password has a hashing algorithm applied to it to make it more secure. While in theory, this is a far better password solution, hackers have found ways around this system as the algorithm used is not exactly a one-way option at all. In fact, hackers can just continue to guess passwords until they gain access to your resources.

‘Salting’ the password

One could consider ‘salting’ a password before it is hashed. What does this mean? Well, a ‘salt’ adds a very long string of bytes to the password. So even though a hacker might gain access to one-way hashed passwords, they should not be able to guess the ‘salt’ string. In theory, this is a great way to secure your data, but if a hacker has access to your source code, they will easily be able to find the ‘salt’ string for passwords.

Random ‘salt’ for each user

As an alternative, a random ‘salt’ string could be added for each user, created on the generation of the user account. This will increase encryption significantly as hackers will have to try to find a password for a single user at a time. Again, even though it means they will have to spend more time cracking the passwords for multiple users, they will still be able to gain access to your resources. It just takes longer.

So, is there a solution for proper password encryption? Something that will protect your valuable data and resources no matter what? Yes, there is! It comes in the form of the BCrypt hashing function — designed by Niels Provos and David Mazières in 1999.

BCrypt is based on the Blowfish block cipher cryptomatic algorithm and takes the form of an adaptive hash function. But why should you use it to protect your data and resources? To explain, we’re going to need to get a little technical…

Using a Key Factor, BCrypt is able to adjust the cost of hashing. With Key Factor changes, the hash output can be influenced. In this way, BCrypt remains extremely resistant to hacks, especially a type of password cracking called rainbow table.

This Key Factor will continue to be a key feature as computers become more powerful in the future. Why? Well, because it compensates for these powerful computers and slows down hashing speed significantly. Ultimately slowing down the cracking process until it’s no longer a viable strategy.

If you have sensitive data or information that you need to be protected, ensuring it is secured correctly is vital. As we have seen, there are many ways to secure this information through various password methods, but only BCrypt offers a truly robust solution.

This article was originally posted at danielboterhoven.tech. Need a website, web application or mobile app built? I can help! Get in touch.

Why you should use BCrypt to hash passwords (2024)

FAQs

Why you should use BCrypt to hash passwords? ›

Bcrypt is a valuable tool to use to hash and store passwords. Its major benefits include: Slow runtime. Bcrypt is a slow-functioning algorithm that takes time to create password hashes and requires time to decrypt them, significantly slowing hacker attempts to break the bcrypt hash.

Is bcrypt recommended? ›

Time taken to crack bcrypt hashed passwords

Compare this to popular hashing algorithms such as MD5 and SHA256, which are designed to hash quickly. They're better for applications that are used frequently and where speed is important, whereas bcrypt is the better option for the safe storage of passwords.

What are the weaknesses of bcrypt? ›

Another drawback of bcrypt is that it may not be suitable for some applications that require fast or frequent hashing operations, such as API authentication or session management. Bcrypt may also introduce some overhead or latency in your system, especially if you use a high work factor.

Is bcrypt outdated? ›

bcrypt is just obsolete – this was to find a successor to it. yescrypt, one of the recommended finalists, is an improved/fixed version of scrypt. "Obsolete" is a very strong word for bcrypt.

Why is bcrypt better than MD5? ›

In the case of MD5, it's possible to generate collision hashes within minutes. Data security systems that rely on MD5 can be easily hacked by anyone with a basic understanding of the function. On the other hand, bcrypt is not broken. As a result, it's still able to keep passwords and information safe.

What is the advantage of bcrypt? ›

Instead of simply hashing the given password, bcrypt adds a random piece of data, called salt, to create a unique hash that is almost impossible to break with automated guesses during hash dictionary and brute force attacks. Bcrypt also stands out among other hashing algorithms because it uses a cost factor.

What is the best hash algorithm for passwords? ›

While Argon2id should be the best choice for password hashing, scrypt should be used when the former is not available. Like Argon2id, scrypt has three different parameters that can be configured: the minimum CPU/memory cost parameter (N), the blocksize (r) and the degree of parallelism (p).

Why not use bcrypt? ›

If you get the right combination, will bcrypt hashing prevent password compromise? No, but then again, there is no silver bullet in cybersecurity, and despite its robustness, bcrypt hashes have been found to be exposed in data breaches.

What is the vulnerability of bcrypt? ›

bcrypt is an A library to help you hash passwords. Affected versions of this package are vulnerable to Insecure Encryption. Data is truncated wrong when its length is greater than 255 bytes.

Is bcrypt easy to crack? ›

Unlike MD5, and SHA-256 hashing algorithms, cracking bcrypt hashes presents a formidable challenge for any malicious actor. For instance, an eight-character password comprising a mix of letters, numbers and symbols would take around 286 years to crack.

Can bcrypt hashes be decrypted? ›

It cannot be decrypted, in the sense that you send the hash result into a function and get the decrypted version.

What is the latest secure hash algorithm? ›

SHA-3 is the latest addition to the SHA family. Developed via a public competition promoted by NIST, it's part of the same standard while being completely different from MD5, SHA-1 and SHA-2.

Why does bcrypt generate different hashes? ›

A BCrypt hash includes salt and as a result this algorithm returns different hashes for the same input.

What is the disadvantage of bcrypt? ›

Bcrypt is slower and requires some memory (4 kiB IIRC), so one spends 100ms to check a valid password whereas an attacker needs days / years to crack it because he's slowed down and can't use GPUs efficiently.

Why MD5 is no longer recommended for use? ›

Weak security: MD5 produces a fixed-sized 128-bit hash value, which is significantly shorter than modern secure hash functions like SHA-256 or SHA-3. A shorter hash length reduces the resistance against brute-force and collision attacks, increasing the risk of an attacker successfully compromising the data.

What is better than bcrypt? ›

I'd recommend you to use Argon2 instead of bcrypt for storing password. It has won the Password Hashing Competition last year and is the recommended way to store passwords. Bcrypt is not bad but it could be used with insecure parameters while Argon2 does not have insecure parameters.

Is it safe to use bcrypt? ›

While bcrypt hashing offers significant protection, it's important to note that it isn't a fail-safe solution against password compromise.

Has bcrypt been broken? ›

No, but then again, there is no silver bullet in cybersecurity, and despite its robustness, bcrypt hashes have been found to be exposed in data breaches.

Should I use Argon2 or bcrypt? ›

Argon2 is a great memory-hard password hashing algorithm, which makes it good for offline key derivation. But it requires more time, which, for web applications is less ideal. bcrypt can deliver hashing times under 1 second long, but does not include parameters like threads, CPU, or memory hardness.

Top Articles
Banking without banks
What is a Personal Finance Class? Why It's Essential for Financial
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Selly Medaline
Latest Posts
Article information

Author: Geoffrey Lueilwitz

Last Updated:

Views: 6030

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Geoffrey Lueilwitz

Birthday: 1997-03-23

Address: 74183 Thomas Course, Port Micheal, OK 55446-1529

Phone: +13408645881558

Job: Global Representative

Hobby: Sailing, Vehicle restoration, Rowing, Ghost hunting, Scrapbooking, Rugby, Board sports

Introduction: My name is Geoffrey Lueilwitz, I am a zealous, encouraging, sparkling, enchanting, graceful, faithful, nice person who loves writing and wants to share my knowledge and understanding with you.