Created
September 24, 2012 09:16
-
-
Save imwilsonxu/3775084 to your computer and use it in GitHub Desktop.
Compare md5 with bcrypt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'bcrypt' | |
password = 'Shh...' | |
amount = 100 | |
Benchmark.bmbm(20) do |run| | |
run.report("Bcrypt(10)") do | |
amount.times do | |
hash = BCrypt::Password.create(password, :cost => 10) | |
end | |
end | |
run.report("Bcrypt(15)") do | |
amount.times do | |
hash = BCrypt::Password.create(password, :cost => 15) | |
end | |
end | |
run.report("MD5") do | |
amount.times do | |
hash = Digest::MD5.hexdigest(password) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment