18 Şubat 2013 Pazartesi
String To MD5 Extension
giriş stringini büyük yada küçük harf olarak MD5 e çevirir
[System.Diagnostics.DebuggerStepThrough]
public static string xToMD5(string giris, bool? buyukHarf)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(giris);
byte[] hashBytes = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hashBytes.Length; i++)
{
if (buyukHarf == null || buyukHarf.Value == false)
sb.Append(hashBytes[i].ToString("x2"));
else
sb.Append(hashBytes[i].ToString("X2"));
}
return sb.ToString();
}
Kaydol:
Kayıtlar (Atom)