Silverlight MD5 Fonksiyonu


public static string Md5(string duzMetin)
{
string _sonuc = "";
System.Text.UnicodeEncoding _ucEnc=new System.Text.UnicodeEncoding();
byte[] _kByte;
System.Security.Cryptography.HashAlgorithm _hAlg;
byte[] _sByte;
if (String.IsNullOrEmpty(duzMetin)) _kByte = _ucEnc.GetBytes("");
else _kByte = _ucEnc.GetBytes(duzMetin);
_hAlg = new System.Security.Cryptography.SHA256Managed();
_sByte = _hAlg.ComputeHash(_kByte);
_sonuc = Convert.ToBase64String(_sByte);
return _sonuc;
}

Yorum yaz