News for hackers. Stuff that matters.
Re:Secure password storage – a myth? by tzs on Saturday April 30, 2011 @03:06PM (#2501286)
I see many recommendations here, and in prior discussions, to use bcrypt. Having finally actually looked up how bcrypt works, I have two concerns.

1. It uses Blowfish, but it modifies how the key schedule and S-boxes are set up. Doesn't that essentially make it no longer Blowfish, but rather Blowfish inspired? Blowfish has a long history and has been well studied. By fiddling with it, don't they throw that out?

2. Suppose you are storing passwords encrypted using bcrypt with a cost factor of n. You decide to increase that to m. How do you compute the new hashes for existing passwords? From the description of the algorithm in their paper, it looks to me like you can only do this by having the original, plaintext password. Thus you can only strengthen a stored password when the user logs in, so you can compute the new stored password.

Both of the above issues could be addressed by doing something like the following. What advantages does bcrypt have over something like this?

    hash_password(start, cost, salt, pass)
        h = pass
        for i = start to cost
            h = sha256(i . ":" . salt . ":" . h)
        return h
To store password p1, with salt s1, and cost c1, compute h1=hash_password(1,c1,s1,p1). Store (c1,s1,h1).

To later update this to a higher cost, c2, compute h2=hash_password(c1+1,c2,s1,h1), and store (c2,s1,h2).

Re:Secure password storage – a myth? by Anne_Ominous on Thursday May 05, 2011 @02:55PM (#2518512)
I can do it even better. As long as it's being done on your own server, and you are only concerned with outside threats, then toss bcrypt over the side, and you can do that in 2 easy steps:

[1] pause for 0.2 seconds (make sure the delay does not block other threads), and

[2] compute your goddamned hash the same way you have always done.