Created
April 10, 2012 06:30
-
-
Save shawnmclean/2348809 to your computer and use it in GitHub Desktop.
SimpleCrypto.Net Basic PBKDF2 Hashing with salt settings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ICryptoService cryptoService = new PBKDF2(); | |
private const int SALT_SIZE = 16; | |
private const int HASH_ITERATIONS = 50; | |
private void SetNewPassword(User user, string newPassword) | |
{ | |
//a new password hash is generated from a generated salt with the passed settings | |
user.Password = user.Password = cryptoService.Compute(newPassword, SALT_SIZE, HASH_ITERATIONS); | |
//assigning the generated salt to the user | |
user.PasswordSalt = cryptoService.Salt; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment