コード例 #1
0
        public char Encipher(char input)
        {
            var encodedChar = shiftCipher1.Encipher(input);

            encodedChar = substitutionCipher.Encipher(encodedChar);
            return(shiftCipher2.Encipher(encodedChar));
        }
コード例 #2
0
        public void Test_Encipher()
        {
            sut = new SubstitutionCipher(testMapping);

            Assert.AreEqual('O', sut.Encipher('A'));
            Assert.AreEqual('R', sut.Encipher('B'));
            Assert.AreEqual('M', sut.Encipher('C'));
            Assert.AreEqual('S', sut.Encipher('D'));
            Assert.AreEqual('F', sut.Encipher('E'));
            Assert.AreEqual('Z', sut.Encipher('F'));
            Assert.AreEqual('B', sut.Encipher('G'));
            Assert.AreEqual('P', sut.Encipher('H'));
            Assert.AreEqual('U', sut.Encipher('I'));
            Assert.AreEqual('E', sut.Encipher('J'));
            Assert.AreEqual('K', sut.Encipher('K'));
            Assert.AreEqual('V', sut.Encipher('L'));
            Assert.AreEqual('Y', sut.Encipher('M'));
            Assert.AreEqual('A', sut.Encipher('N'));
            Assert.AreEqual('L', sut.Encipher('O'));
            Assert.AreEqual('Q', sut.Encipher('P'));
            Assert.AreEqual('T', sut.Encipher('Q'));
            Assert.AreEqual('J', sut.Encipher('R'));
            Assert.AreEqual('I', sut.Encipher('S'));
            Assert.AreEqual('W', sut.Encipher('T'));
            Assert.AreEqual('D', sut.Encipher('U'));
            Assert.AreEqual('N', sut.Encipher('V'));
            Assert.AreEqual('X', sut.Encipher('W'));
            Assert.AreEqual('H', sut.Encipher('X'));
            Assert.AreEqual('C', sut.Encipher('Y'));
            Assert.AreEqual('G', sut.Encipher('Z'));
        }