示例#1
0
        public void TestSetKey()
        {
            for (var setKeyIndex = variableKey.Length; setKeyIndex < plaintextL.Length; setKeyIndex++)
            {
                var blowfish = new Blowfish(setKey.Take(setKeyIndex - variableKey.Length + 1).ToArray());

                var l = plaintextL[setKeyIndex];
                var r = plaintextR[setKeyIndex];

                blowfish.BlowfishEncipher(ref l, ref r);

                Assert.AreEqual(cipherTextL[setKeyIndex], l);
                Assert.AreEqual(cipherTextR[setKeyIndex], r);
            }
        }
示例#2
0
        public void TestVariableKeys()
        {
            for (var variableKeyIndex = 0; variableKeyIndex < variableKey.Length; variableKeyIndex++)
            {
                var blowfish = new Blowfish(variableKey[variableKeyIndex]);

                var l = plaintextL[variableKeyIndex];
                var r = plaintextR[variableKeyIndex];

                blowfish.BlowfishEncipher(ref l, ref r);

                Assert.AreEqual(cipherTextL[variableKeyIndex], l);
                Assert.AreEqual(cipherTextR[variableKeyIndex], r);
            }
        }