コード例 #1
0
        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));
        }
コード例 #2
0
        public void EncryptFileTest()
        {
            OneTimePad cipher = new OneTimePad();

            cipher.Encrypt(BASE_FILE, ENC_FILE);
            TestFileEnc();
        }
コード例 #3
0
        public void EncryptNoKeyTest()
        {
            OneTimePad myCipher = new OneTimePad();

            TestCtor(myCipher);
            myCipher.Encrypt(TEST_STR);
        }
コード例 #4
0
        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)));
 }