git ssb

0+

dangerousbeans / %aPBe2k3ugtjBr4rrsU1…



Commit 1133c7504687c6affcf846bedee5fa83bf74cc8a

Added better documentation on cost factors.

git-svn-id: http://bcrypt-ruby.rubyforge.org/svn/trunk@38 b1e0f299-433e-4bb3-9895-84128a6cfb6a
codahale committed on 6/16/2007, 12:33:42 AM
Parent: 62fc1729c7b2f9ad485afb1f4b948b89dad341b6

Files changed

READMEchanged
READMEView
@@ -90,8 +90,10 @@
9090 == How bcrypt() works
9191
9292 bcrypt() is a hashing algorithm designed by Niels Provos and David Mazières of the OpenBSD Project.
9393
94+=== Background
95+
9496 Hash algorithms take a chunk of data (e.g., your user's password) and create a "digital fingerprint," or hash, of it.
9597 Because this process is not reversible, there's no way to go from the hash back to the password.
9698
9799 In other words:
@@ -101,13 +103,17 @@
101103 You can store the hash and check it against a hash made of a potentially valid password:
102104
103105 <unique gibberish> =? hash(just_entered_password)
104106
107+=== Rainbow Tables
108+
105109 But even this has weaknesses -- attackers can just run lists of possible passwords through the same algorithm, store the
106110 results in a big database, and then look up the passwords by their hash:
107111
108112 PrecomputedPassword.find_by_hash(<unique gibberish>).password #=> "secret1"
109113
114+=== Salts
115+
110116 The solution to this is to add a small chunk of random data -- called a salt -- to the password before it's hashed:
111117
112118 hash(salt + p) #=> <really unique gibberish>
113119
@@ -136,11 +142,19 @@
136142
137143 If an attacker was using Ruby to check each password, they could check ~140,000 passwords a second with MD5 but only
138144 ~450 passwords a second with bcrypt().
139145
146+=== Cost Factors
147+
140148 In addition, bcrypt() allows you to increase the amount of work required to hash a password as computers get faster. Old
141149 passwords will still work fine, but new passwords can keep up with the times.
142150
151+The default cost factor used by bcrypt-ruby is 10, which is fine for session-based authentication. If you are using a
152+stateless authentication architecture (e.g., HTTP Basic Auth), you will want to lower the cost factor to reduce your
153+server load and keep your request times down. This will lower the security provided you, but there are few alternatives.
154+
155+== More Information
156+
143157 bcrypt() is currently used as the default password storage hash in OpenBSD, widely regarded as the most secure operating
144158 system available.
145159
146160

Built with git-ssb-web