C♯, C#相談室 Part34
■ このスレッドは過去ログ倉庫に格納されています
0584デフォルトの名無しさん
2006/10/03(火) 06:43:49ハッシュ生成についてなんですが
privae string CreateHash(string Src)
{
System.Security.Cryptography.SHA1CryptoServiceProvider HashSHA1 = new System.Security.Cryptography.SHA1CryptoServiceProvider();
//バイト配列に変換し、ハッシュ生成
//byte[] has = HashSHA1.ComputeHash(System.Text.Encoding.ASCII.GetBytes(Src));
//ハッシュを16進数に変換し、string型として保存
string hash = "";
for (int i = 0; i < HashSHA1.ComputeHash(System.Text.Encoding.ASCII.GetBytes(Src)).Length; i++)
hash += HashSHA1.ComputeHash(System.Text.Encoding.ASCII.GetBytes(Src))[i].ToString("X");
Src = null;
}
続く
■ このスレッドは過去ログ倉庫に格納されています