Last active
March 21, 2019 18:14
-
-
Save edamtoft/56f9ec95046e58964c653a5a9d4aec3a to your computer and use it in GitHub Desktop.
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
public string Hash(string password) | |
{ | |
using (var algorithm = new Rfc2898DeriveBytes( | |
password, | |
SaltSize, | |
Options.Iterations, | |
HashAlgorithmName.SHA256)) | |
{ | |
var key = Convert.ToBase64String(algorithm.GetBytes(KeySize)); | |
var salt = Convert.ToBase64String(algorithm.Salt); | |
return $"{Options.Iterations}.{salt}.{key}"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment