/// <summary>Hash</summary> public string Hash(string plain) { using MD5 md5 = new MD5CryptoServiceProvider(); byte[] fromData = ChaoticBase64.FromBase64String(plain); byte[] bytes = md5.ComputeHash(fromData); return(ChaoticHex(bytes)); }
/// <summary>解密</summary> public string Decrypt(string encrypt, string iv) { byte[] byteArray = ChaoticBase64.FromBase64String(encrypt); byte[] IV = Encoding.ASCII.GetBytes(iv); using var ms = new MemoryStream(); using var des = new DESCryptoServiceProvider(); using var crypto = des.CreateDecryptor(KEY, IV); using var cs = new CryptoStream(ms, crypto, CryptoStreamMode.Write); cs.Write(byteArray, 0, byteArray.Length); cs.FlushFinalBlock(); return(Encoding.UTF8.GetString(ms.ToArray())); }