jestem generowania soli i wartości hash z moich haseł za pomocą,[Sql-Server] jakiego typu danych użyć dla wartości salt hash i wartości hash i jakiej długości?
string salt = CreateSalt(TxtPassword.Text.Length);
string hash = CreatePasswordHash(TxtPassword.Text, salt);
private static string CreateSalt(int size)
{
//Generate a cryptographic random number.
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
byte[] buff = new byte[size];
rng.GetBytes(buff);
// Return a Base64 string representation of the random number.
return Convert.ToBase64String(buff);
}
private static string CreatePasswordHash(string pwd, string salt)
{
string saltAndPwd = String.Concat(pwd, salt);
string hashedPwd =
FormsAuthentication.HashPasswordForStoringInConfigFile(
saltAndPwd, "sha1");
return hashedPwd;
}
Jaki typ danych proponujesz do przechowywania tych wartości w serwerze SQL? Wszelkie sugestie ...
Sól: 9GsPWpFD
Hash: E778AF0DC5F2953A00B35B35D80F6262CDBB8567
+ dobre pytanie. –