Exemple #1
0
 /// <summary>
 /// 使用3DES解密字符串
 /// </summary>
 public static string DecryptString(string encrypted, string key)
 {
     byte[] buff = System.Text.Encoding.UTF8.GetBytes(encrypted);
     byte[] res  = DesEncryption.Decrypt(buff, key);
     return(System.Text.Encoding.UTF8.GetString(res));
 }
Exemple #2
0
 /// <summary>
 /// 使用3DES加密字符串
 /// </summary>
 public static string EncryptString(string origin, string key)
 {
     byte[] buff = System.Text.Encoding.UTF8.GetBytes(origin);
     byte[] res  = DesEncryption.Encrypt(buff, key);
     return(System.Text.Encoding.UTF8.GetString(res));
 }
Exemple #3
0
        /// <summary>
        /// 使用3DES解密
        /// </summary>
        public static byte[] Decrypt(byte[] encrypted, string key)
        {
            DesEncryption desEncryption = new DesEncryption(DesStrategy.Des3, key);

            return(desEncryption.Decrypt(encrypted));
        }
Exemple #4
0
        /// <summary>
        /// 使用3DES加密
        /// </summary>
        public static byte[] Encrypt(byte[] origin, string key)
        {
            DesEncryption desEncryption = new DesEncryption(DesStrategy.Des3, key);

            return(desEncryption.Encrypt(origin));
        }
 /// <summary>
 /// 使用3DES解密
 /// </summary> 
 public static byte[] Decrypt(byte[] encrypted, string key)
 {
     DesEncryption desEncryption = new DesEncryption(DesStrategy.Des3, key);
     return desEncryption.Decrypt(encrypted);
 }
 /// <summary>
 /// 使用3DES加密
 /// </summary>        
 public static byte[] Encrypt(byte[] origin, string key)
 {
     DesEncryption desEncryption = new DesEncryption(DesStrategy.Des3, key);
     return desEncryption.Encrypt(origin);
 }