![]() |
|
[C#] pbkdf2-sha256 implementation in C# - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C#] pbkdf2-sha256 implementation in C# (/showthread.php?tid=5249050) |
pbkdf2-sha256 implementation in C# - morphine1337 - Apr 25, 2016 Hello, i need a method to hash a string so it will give me the same output as PHP Code I know it has to do with Rfc2898DeriveBytes but i cant make it work * - GuRuHaX - Apr 25, 2016 A small example of Rfc2898DeriveBytes : PHP Code Another example : ( Source : https://cmatskas.com/-net-password-hashing-using-pbkdf2/ ) PHP Code You can find an example here : http://lockmedown.com/hash-right-implementing-pbkdf2-net/ Hope this helps ! 🤝 * - morphine1337 - Apr 25, 2016 I know how to use Rfc2898DeriveBytes. But its default algorithm for hashing is sha1 and i need sha256. So my question is: how to use Rfc2898DeriveBytes with another hashing algo, specifically sha256 ? * - GuRuHaX - Apr 25, 2016 (Apr 25, 2016 10:24 AM)morphine1337 Wrote: I know how to use Rfc2898DeriveBytes. But its default algorithm for hashing is sha1 and i need sha256. So my question is: how to use Rfc2898DeriveBytes with another hashing algo, specifically sha256 ? Rfc2898DeriveBytes is unfortunately not configurable to use a different hash function as far that i know of, so you'll have to make your own functionality. This is what i found doing a little search : PHP Code You could also use Bouncy Castle. The C# specification lists the algorithm "PBEwithHmacSHA-256", which can only be PBKDF2 with SHA-256. 🤝 * - idb. - Apr 25, 2016 http://stackoverflow.com/a/18649357 is source for the above code. Just want to make sure author gets proper credit. |