Assets/Watson/Scripts/Utilities/Utility.cs
/// <summary>
/// Get the MD5 hash of a string.
/// </summary>
/// <param name="s"></param>
/// <returns></returns>
Get the MD5 hash of a string.
Get the MD5 hash of a string .
public static string GetMD5(string s)
        {
            if (string.IsNullOrEmpty(s))
                return string.Empty;
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] data = Encoding.Default.GetBytes(s);
            byte[] result = md5.ComputeHash(data);
            StringBuilder output = new StringBuilder();
            foreach (var b in result)
                output.Append(b.ToString("x2"));
            return output.ToString();
        }
public static string GetMD5 ( string s ) { if ( string . IsNullOrEmpty ( s ) ) return string . Empty ; MD5 md5 = new MD5CryptoServiceProvider ( ) ; byte [ ] data = Encoding . Default . GetBytes ( s ) ; byte [ ] result = md5 . ComputeHash ( data ) ; StringBuilder output = new StringBuilder ( ) ; foreach ( var b in result ) output . Append ( b . ToString ( " " ) ) ; return output . ToString ( ) ; }
Get the MD5 hash of a string.
Get the MD5 hash of a string .
None
s
string
None