2013년 10월 22일 화요일

암호화


static public string MD5Hash(string text) 
{  
System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(); 
byte[] bytes = utf8.GetBytes(text); 
// encrypt bytes 
MD5 md5 = new MD5CryptoServiceProvider(); 
byte[] hashBytes = md5.ComputeHash(bytes); 
// Convert the encrypted bytes back to a string (base 16) 
string hash = ""
for (int i = 0; i < hashBytes.Length; i++) 
{  
hash += System.Convert.ToString(hashBytes[i], 16).PadLeft(2, '0'); 
}  
return hash.PadLeft(32, '0'); 
}


. Unity에서 UTF-16을 사용할 수 없다.


댓글 없음:

댓글 쓰기