Monday, March 19, 2012

Don't use bcrypt

(Edit: Some numbers for you people who like numbers)

If you're already using bcrypt, relax, you're fine, probably. However, if you're looking for a key derivation function (or in bcrypt's case, password encryption function) for a new project, bcrypt is probably not the best one you can pick. In fact, there are two algorithms which are each better in a different way than bcrypt, and also widely available across many platforms.

I write this post because I've noticed a sort of "JUST USE BCRYPT" cargo cult (thanks Coda Hale!) This is absolutely the wrong attitude to have about cryptography. Even though people who know much more about cryptography than I do have done an amazing job packaging these ciphers into easy-to-use libraries, use of cryptography is not something you undertake lightly. Please know what you're doing when you're using it, or else it isn't going to help you.

The first cipher I'd suggest you consider besides bcrypt is PBKDF2. It's ubiquitous and time-tested with an academic pedigree from RSA Labs, you know, the guys who invented much of the cryptographic ecosystem we use today. Like bcrypt, PBKDF2 has an adjustable work factor. Unlike bcrypt, PBKDF2 has been the subject of intense research and still remains the best conservative choice.

There has been considerably less research into the soundness of bcrypt as a key derivation function as compared to PBKDF2, and simply for that reason alone bcrypt is much more of an unknown as to what future attacks may be discovered against it. bcrypt has a higher theoretical-safety-to-compute-time factor than PBKDF2, but that won't help you if an attack is discovered which mitigates bcrypt's computational complexity. Such attacks have been found in the past against ciphers like 3DES. Where 3DES uses a 168-bit key, various attacks have reduced that key size's effectiveness to 80-bits.

PBKDF2 is used by WPA, popular password safes like 1Password and LastPass, and full-disk encryption tools like TrueCrypt and FileVault. While I often poke fun at Lamer News as a Sinatra antipattern, I have to applaud antirez on his choice of PBKDF2 when he got bombarded with a "just use bcrypt!" attack (although bro, antirez, there's a PBKDF2 gem you can use, you don't have to vendor it)

The second cipher to consider is scrypt. Not only does scrypt give you more theoretical safety than bcrypt per unit compute time, but it also allows you to configure the amount of space in memory needed to compute the result. Where algorithms like PBKDF2 and bcrypt work in-place in memory, scrypt is a "memory-hard" algorithm, and thus makes a brute-force attacker pay penalties both in CPU and in memory. While scrypt's cryptographic soundness, like bcrypt's, is poorly researched, from a pure algorithmic perspective it's superior on all fronts.

The next time you need to pick a key derivation function, please, don't use bcrypt.

1,411 comments:

«Oldest   ‹Older   1401 – 1411 of 1411
Vicky Paul said...

We are extremely thankful for your blog entry. You will discover a ton of approaches subsequent to visiting your post.
MetaboFix
ThyraFemme Balance
Brain C13
Aqua Burn
Finessa
Synaptigen
Ozelyt
Gold Align

Vicky Paul said...

Please Keep writing such kind of interesting on your page. I am really impressed with this type of writing. Thanks for sharing this with us.
Ring Clear
Vigor Long
Stratos Alpha
DigestiStart
VisiSharp
Neurozoom
Tinnitrol
Tinnitrol
MoveWell Daily

Vicky Paul said...

I’ve always enjoyed reading your article. Your topics are so interesting and content is mindblowing, whenever I start reading I couldn’t stop to read the full article.
CogniStrong
Quietum Plus
CogniStrong
Neuroxen
MobillityMD
Urinoct
Joint N11
CogniSurge
DigestiStart

Vicky Paul said...

Nice blog, the article you have shared is good. This article is very useful. My friend suggest me to use this blog.
Neurozoom
Nerve fresh
Pineal Activator
Pineal Awakening
Mitolyn
Nervala
Ignitra
Nerve Alive
LungExpand Pro
Men’s Growth

Vicky Paul said...

If you want to learn how to invest your money in the share market or you want to choose your right stocks that makes you rich.
Menovelle
Glucotrust
Kerassentials
Nitric Boost Ultra
Neuro Surge
Sciatica Pro
Fluxactive
EyeFortin
Neurodrine

Vicky Paul said...

It was a great informative post. Proceed many Useful and enlightening links. Loved your writings also. Concept of this subject was well discussed.
Gluco Berry
Nu Nerve
Audifort
Flushfactor
Quietum Plus
Sleep Lean
Ikaria Juice
Mitolyn
Prime Biome
Sugar Defender

Vicky Paul said...

You’ve done it, and beautifully! I’m raising my glass of tea to you in celebration of this enormous achievement!.
SlimCrystal
HerpaFend
TotalControl24
Pyramid Wealth Frequency
Peak BioBoost
Prime Biome
Resurge
MetaboFlex
Plantsulin

Vicky Paul said...

Nice information. Thanks for sharing this informative blog with us. I really need this type of blog and I’m so lucky to found this. also visit
Alpha Surge
Urinoct
JointVive
VertiAid
NeuroPrime
DigestSync
Arialief
Neuro fortis Pro
VenoPlus 8
Ageless Knees

Vicky Paul said...

Our students get live trading experience with one-to-one mentoring and top-of-the-line facilities, technology and educators.
VitaSeal
Leptozan
Revitag
Oradentum
NanoDefense Pro
SeroBurn
Renew Dental Support
Prosta Peak
Gluco6
Igenics

Vicky Paul said...

Most of the traders don’t follow the trend, they try to sell or buy on market sentiment which is risky. To know the market trend trader should learn the technical analysis course.
Alpha Surge
Sugar Defender
Zencortex
HepatoBurn
LungExpand Pro
Breathe
MetaNail Serum Pro
Nerve Revive
NanoDefense Pro

Vicky Paul said...

This is the common mistake in share market they don’t know the trend of the market. Trading against the trend is highly risky.
VITALS STORE
Prodentim
Java Burn
Vertigenics
AquaSculpt
Prostavive
Claritox pro
Titan Flow
Pineal Guardian

«Oldest ‹Older   1401 – 1411 of 1411   Newer› Newest»