Okay. My salt value is ???? i not sure why here is my method for the salt and hash
Salt method
UnicodeEncoding utf16 = new UnicodeEncoding();
if (utf16 != null)
{
Random random = new Random(unchecked((int)DateTime.Now.Ticks));
if (random != null)
{
byte[] saltValue = new byte[8];
random.NextBytes(saltValue);
string saltValueString = utf16.GetString(saltValue);
Hash method
UnicodeEncoding encoding = new UnicodeEncoding();
SHA512Managed hashing = new SHA512Managed();
string salt = string.Empty;
if (tb_password.Text != null && hashing != null && encoding != null)
{
if (salt == null)
{
// Generate a salt string.
salt = encoding.GetString(saltValue);
}
byte[] binarySaltValue = new byte[8];
binarySaltValue[0] = byte.Parse(salt.Substring(0, 2), System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture.NumberFormat);
binarySaltValue[1] = byte.Parse(salt.Substring(2, 2), System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture.NumberFormat);
binarySaltValue[2] = byte.Parse(salt.Substring(4, 2), System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture.NumberFormat);
binarySaltValue[3] = byte.Parse(salt.Substring(6, 2), System.Globalization.NumberStyles.HexNumber, CultureInfo.InvariantCulture.NumberFormat);
byte[] valueToHash = new byte[8 + encoding.GetByteCount(tb_password.Text)];
byte[] binaryPassword = encoding.GetBytes(tb_password.Text);
binarySaltValue.CopyTo(valueToHash, 0);
binaryPassword.CopyTo(valueToHash, 8);
byte[] hashValue = hashing.ComputeHash(valueToHash);
string hashedPassword = salt;
foreach (byte hexdigit in hashValue)
{
hashedPassword += hexdigit.ToString("X2", CultureInfo.InvariantCulture.NumberFormat);
}