News for hackers. Stuff that matters.
Re:An HN style social news site written in Ruby/Sinatra/Redi... by daeken on Thursday October 20, 2011 @06:47PM (#3137460)
I would strongly recommend that rather than doing that, go with standard PBKDF2. In essence, HMAC(HMAC(HMAC(...(password)))) with a per-user salt. I generally recommend 10k+ rounds with PBKDF2 (each one is cheap). This wouldn't give you an additional dependency and is super easy to put in place -- I'll do it, if you want.
Re:An HN style social news site written in Ruby/Sinatra/Redi... by pjscott on Thursday October 20, 2011 @08:53PM (#3137815)
If you concatenate your password and a salt, then iterate a cryptographic hash like SHA256 a few thousand times, this is almost exactly PBKDF1. It's a good, respectable password hashing scheme. The main advantage that PBKDF2 offers is the ability to produce arbitrary output sizes.

(The difference between this and PBKDF1 is that PBKDF1 requires using either MD2 or SHA1 as the hash function, and hasn't been updated to reflect the availability of SHA-256 and SHA-512.)

Re:An HN style social news site written in Ruby/Sinatra/Redi... by codahale on Thursday October 20, 2011 @07:09PM (#3137543)
Re:An HN style social news site written in Ruby/Sinatra/Redi... by antirez on Friday October 21, 2011 @03:27AM (#3138819)
Note that PBKDF1 is exactly that, vanilla chaining of the same hash function. And AFAIK is not believed to have known attacks, with the only drawback being the fixed output size.

I guess that the xor approach used in PBKDF2 is useful since you want to compute T1, T2, T3 ..., Tc that are multiple output blocks all starting from the same input, so this gives more information to the attacker and the schema is designed to avoid showing some "state" that is possible to more easily analyze. Not sure, but the point is, I don't think PBKDF1 is unsafe either, and it is just chaining.