public static string DESEncrypt(string value, Encoding encoding) { return EncryptHelper.DESEncrypt(value, encoding, EncryptHelper.cryptKey, EncryptHelper.cryptIV); }
public static string DESEncrypt(string value, Encoding encoding, byte[] cryptKey = null, byte[] cryptIV = null) { byte[] bytes = encoding.GetBytes(value); byte[] inArray = EncryptHelper.DESEncrypt(bytes, cryptKey, cryptIV); return System.Convert.ToBase64String(inArray); }
public static string DESEncrypt(string value) { return EncryptHelper.DESEncrypt(value, Encoding.Default); }
public static byte[] DESDecrypt(byte[] data, byte[] cryptKey = null, byte[] cryptIV = null) { System.Security.Cryptography.DESCryptoServiceProvider dESCryptoServiceProvider = EncryptHelper.CreateDESCrypto(); System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); System.Security.Cryptography.CryptoStream cryptoStream = new System.Security.Cryptography.CryptoStream(memoryStream, dESCryptoServiceProvider.CreateDecryptor(cryptKey, cryptIV), System.Security.Cryptography.CryptoStreamMode.Write); cryptoStream.Write(data, 0, data.Length); cryptoStream.FlushFinalBlock(); return memoryStream.ToArray(); }
public static string DESDecrypt(string value, Encoding encoding, byte[] cryptKey, byte[] cryptIV) { byte[] data = System.Convert.FromBase64String(value); byte[] bytes = EncryptHelper.DESDecrypt(data, cryptKey, cryptIV); return encoding.GetString(bytes); }
public static string Base64Encode(string value) { return EncryptHelper.Base64Encode(value, System.Text.Encoding.Default); }
public static string CreateToken(string s1, string s2, string s3) { return(EncryptHelper.Md5(string.Concat(s1, s2, s3), 32, System.Text.Encoding.UTF8)); }