private static ICryptographyProvider LoadProvider() { ICryptographyProvider result = null; switch (encryptFormat) { case EncryptFormat.Encrypted: result = new SymmetricAlgorithmProvider(); break; case EncryptFormat.None: result = new NonCryptoProvider(); break; default: result = new HashAlgorithmProvider(); break; } return result; }
public static string DesEncode(string plainText) { ICryptographyProvider cryptographyProvider = new SymmetricAlgorithmProvider(AlgorithmFormat.DES); return cryptographyProvider.Encrypt(plainText); }
public static string DesDecode(string cypherText) { ICryptographyProvider cryptographyProvider = new SymmetricAlgorithmProvider(AlgorithmFormat.DES); return cryptographyProvider.Decrypt(cypherText); }