示例#1
0
        public string Encrypt(string plainText)
        {
            string cipherText = plainText;

            CaesarCipher caesarCipher = new CaesarCipher();

            caesarCipher.SetKey(CAESAR_CIPHER_KEY);
            cipherText = caesarCipher.Encrypt(cipherText);

            AffineCipher affineCipher = new AffineCipher();

            affineCipher.SetKeys(new int[] { AFFINE_CIPHER_KEY_A, AFFINE_CIPHER_KEY_B });
            cipherText = affineCipher.Encrypt(cipherText);

            SimpleSubstitutionCipher simpleSubstitutionCipher = new SimpleSubstitutionCipher();

            simpleSubstitutionCipher.SetKey(SIMPLE_SUBSTITUTION_CIPHER_KEY);
            cipherText = simpleSubstitutionCipher.Encrypt(cipherText);

            return(cipherText);
        }