How can I hash passwords with salt and iterations using PBKDF2 HMAC SHA-256 or SHA-512 in C#?

asp.net, c#, encryption

Solution

The PWDTK.NET library (http://sourceforge.net/projects/pwdtknet/) seems to be the only implementation I can find that does PBKDF2 HMAC SHA-512 and allows for salt and iterations. I have not been able to locate test vectors for PBKDF2 HMAC SHA-512 to test with.

I am surprised that there are not more devs out there using this already.

Not a big fan of answering my own questions, but since the comments degraded into a discussion about speed and no one else has answered yet, I might as well.

Thanks for all who commented.

Problem

I would like to find a solution or method that will allow me to add salt and control the number of iterations. The native Rfc2898DeriveBytes is based on HMACSHA1. Ideally, using SHA-256 or SHA-512 will make the system future proof. This is the best example I have found so far: http://jmedved.com/2012/04/pbkdf2-with-sha-256-and-others/ but when I ran it with SHA-256 it was actually slower than with SHA-512. I used 64k iterations, a guid for salt and different same length passwords to compare. I also found this solution: http://sourceforge.net/projects/pwdtknet/ which has full source code available. It seems to be more robust. So far I am not able to get the same output from each of them.

Original source

Related problems