c#
php md5() 함수와 동일한 기능의 C#함수
관절분리
2016. 1. 28. 11:24
반응형
public static string MD5(string password) {
byte[] textBytes = System.Text.Encoding.Default.GetBytes(password);
try {
System.Security.Cryptography.MD5CryptoServiceProvider cryptHandler;
cryptHandler = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] hash = cryptHandler.ComputeHash (textBytes);
string ret = "";
foreach (byte a in hash) {
if (a<16)
ret += "0" + a.ToString ("x");
else
ret += a.ToString ("x");
}
return ret ;
}
catch {
throw;
}
}
출처 : http://www.spiration.co.uk/post/1203/MD5-in-C%23---works-like-php-md5()-example
반응형