Esempio n. 1
0
        public void Decrypt_InputAndOffsetAndLength()
        {
            const string key = "Key";
            const string expectedPlainText = "Plaintext";
            var          encoding          = Encoding.ASCII;
            var          cipher            = new Arc4Cipher(encoding.GetBytes(key), false);
            var          cipherText        = new byte[] { 0x0A, 0x0f, 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3, 0x0d, 0x05 };

            var actualPlainText = cipher.Decrypt(cipherText, 2, cipherText.Length - 4);

            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
        }
Esempio n. 2
0
        public void Decrypt_DischargeFirstBytes_False1()
        {
            const string key = "Key";
            const string expectedPlainText = "Plaintext";
            var          encoding          = Encoding.ASCII;
            var          cipher            = new Arc4Cipher(encoding.GetBytes(key), false);
            var          cipherText        = new byte[] { 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3 };

            var actualPlainText = cipher.Decrypt(cipherText);

            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
        }
Esempio n. 3
0
        public void Decrypt_DischargeFirstBytes_False2()
        {
            const string key = "Wiki";
            const string expectedPlainText = "pedia";
            var          encoding          = Encoding.ASCII;
            var          cipher            = new Arc4Cipher(encoding.GetBytes(key), false);
            var          cipherText        = new byte[] { 0x10, 0X21, 0xBF, 0x04, 0x20 };

            var actualPlainText = cipher.Decrypt(cipherText);

            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
        }
Esempio n. 4
0
        public void DecryptTest()
        {
            byte[]     key    = null;                      // TODO: Initialize to an appropriate value
            Arc4Cipher target = new Arc4Cipher(key, true); // TODO: Initialize to an appropriate value

            byte[] input    = null;                        // TODO: Initialize to an appropriate value
            byte[] expected = null;                        // TODO: Initialize to an appropriate value
            byte[] actual;
            actual = target.Decrypt(input);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }