public void DecryptStrTest()
        {
            OneTimePad myCipher = new OneTimePad(TEST_STR.Length);

            TestCtor(myCipher);
            myCipher.GenKey();
            string encStr = myCipher.Encrypt(TEST_STR);

            TestStrEnc(myCipher, myCipher.Encrypt(TEST_STR), TEST_STR.Length);
            TestStrDec(encStr, myCipher.Decrypt(encStr));
        }
        public void EncryptFileTest()
        {
            OneTimePad cipher = new OneTimePad();

            cipher.Encrypt(BASE_FILE, ENC_FILE);
            TestFileEnc();
        }
        public void EncryptNoKeyTest()
        {
            OneTimePad myCipher = new OneTimePad();

            TestCtor(myCipher);
            myCipher.Encrypt(TEST_STR);
        }
        public void EncryptStrTest()
        {
            OneTimePad myCipher = new OneTimePad(TEST_STR.Length);

            TestCtor(myCipher);
            myCipher.GenKey();
            TestStrEnc(myCipher, myCipher.Encrypt(TEST_STR), TEST_STR.Length);
        }
Пример #5
0
 public void CheckConsistency()
 {
     byte[] bytes = new byte[] { 5, 8, 5, 1, 2, 3, 32, 64 };
     byte[] key   = new byte[] { 1, 2, 3, 4, 5, 6, 7, 8 };
     Assert.Equal(bytes, OneTimePad.Decrypt(key, OneTimePad.Encrypt(key, bytes)));
 }