3 ms·
Don't confuse SHA-512 hashing once with SHA-512 hashing 1000 times though.
by yuhong 15y ago
Don't confuse SHA-512 hashing once with SHA-512 hashing 1000 times though.
- bradleyland 15y agoNo one is confused. SHA-512 is designed to be very, very fast. I just ran a very rudimentary test comparing SHA-512 and BCrypt with these results. BCrypt 1000 iteration test script: https://gist.github.com/1058610 https://gist.github.com/1058610 # => That took 76.370953 seconds BCrypt 1 iteration test script: (same as above but with `1.times do`) # => That took 0.074209 seconds SHA512 1000 iteration test script: # => That took 0.004092 seconds SHA512 at 1000 iterations is over 18,000 times faster than BCrypt at similar iterations; which, by the way, makes no sense to do. BCrypt has a "cost" factor, which is used to adjust the computational complexity to your use case. This is why BCrypt makes so much more sense for password encryption than something like SHA512. Running SHA512 n times is just a cheap, ineffective imitation of BCrypt.