/// <summary> /// /// </summary> /// <param name="algorithm"></param> /// <returns></returns> public static ICryptographer GetCryptographer(CryptoAlgorithm algorithm) { ICryptographer crypto = null; switch (algorithm) { case CryptoAlgorithm.DES: crypto = new DESCryptographer(); break; case CryptoAlgorithm.RC2: crypto = new RC2Cryptographer(); break; case CryptoAlgorithm.Rijndael: crypto = new RijndaelCryptographer(); break; case CryptoAlgorithm.TripleDES: crypto = new TripleDESCryptographer(); break; case CryptoAlgorithm.RSA: crypto = new RSACryptorapher(); break; case CryptoAlgorithm.MD5: crypto = new MD5HashCryptographer(); break; case CryptoAlgorithm.HMACMD5: crypto = new HMACMD5HashCryptographer(); break; case CryptoAlgorithm.SHA1: crypto = new SHA1HashCryptographer(); break; default: Debug.Assert(false); break; } Debug.Assert(crypto != null); return(crypto); }
/// <summary> /// /// </summary> /// <param name="algorithm"></param> /// <returns></returns> public static ICryptographer GetCryptographer(CryptoAlgorithm algorithm) { ICryptographer crypto = null; switch (algorithm) { case CryptoAlgorithm.DES: crypto = new DESCryptographer(); break; case CryptoAlgorithm.RC2: crypto = new RC2Cryptographer(); break; case CryptoAlgorithm.Rijndael: crypto = new RijndaelCryptographer(); break; case CryptoAlgorithm.TripleDES: crypto = new TripleDESCryptographer(); break; case CryptoAlgorithm.RSA: crypto = new RSACryptorapher(); break; case CryptoAlgorithm.MD5: crypto = new MD5HashCryptographer(); break; case CryptoAlgorithm.HMACMD5: crypto = new HMACMD5HashCryptographer(); break; case CryptoAlgorithm.SHA1: crypto = new SHA1HashCryptographer(); break; default: Debug.Assert(false); break; } Debug.Assert(crypto != null); return crypto; }