using System; using System.Collections.Generic; using System.Security.Cryptography; using System.Text; namespace TEAMModelOS.SDK.Helper.Security.TmdCrypt { public static class TmdCrypt { private static string DoSHA256AndBase64(string password) { SHA256 sha256 = new SHA256CryptoServiceProvider();//建立一個SHA256 byte[] source = Encoding.Default.GetBytes(password);//將字串轉為Byte[] byte[] crypto = sha256.ComputeHash(source);//進行SHA256加密 string resultSha256 = Convert.ToBase64String(crypto); sha256.Dispose(); return resultSha256; } /// /// TMD密码加密 /// /// /// public static string Encrypt(string password) { return DoSHA256AndBase64(DoSHA256AndBase64(DoSHA256AndBase64(password) + DoSHA256AndBase64(password)) + DoSHA256AndBase64(password)); } } }