Created
June 15, 2016 07:05
-
-
Save rajdeep26/32bdba87fe1f14b241a9dbab9ee94f55 to your computer and use it in GitHub Desktop.
Benchmarking ruby's hashing algorithms
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
SRC = SecureRandom.uuid | |
Benchmark.bmbm do |bm| | |
bm.report('MD5') { 100000.times{ Digest::MD5.hexdigest SRC } } | |
bm.report('SHA1') { 100000.times{ Digest::SHA1.hexdigest SRC } } | |
bm.report('SHA2') { 100000.times{ Digest::SHA2.hexdigest SRC } } | |
bm.report('SHA256') { 100000.times{ Digest::SHA256.hexdigest SRC } } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment