Web サイトのカスタム メンバーシップを作成したいのですが、ASP.NET メンバーシップは使用したくありません。
ASP.NET メンバーシップのハッシュ化されたパスワードと同様に、カスタム メンバーシップでハッシュ化されたパスワードを使用したいと考えています。
次のコードは正しく、最適ですか?
public string EncodePassword(string pass, string salt)
{
byte[] bytes = Encoding.Unicode.GetBytes(pass);
byte[] src = Encoding.Unicode.GetBytes(salt);
byte[] dst = new byte[src.Length + bytes.Length];
Buffer.BlockCopy(src, 0, dst, 0, src.Length);
Buffer.BlockCopy(bytes, 0, dst, src.Length, bytes.Length);
HashAlgorithm algorithm = HashAlgorithm.Create("SHA1");
byte[] inArray = algorithm.ComputeHash(dst);
return Convert.ToBase64String(inArray);
}