Пример #1
0
        public void EncodeAndDecode()
        {
            byte[]       block   = hasher.ComputeHash(Key);
            byte[]       copy    = (byte[])block.Clone();
            BlockEncoder encoder = new BlockEncoder(new KeyScheduler {
                Key = Key, IV = IV
            });
            List <EncodingPlan> plans = encoder.GetEncodingPlans(block.Length, CryptoTransform.MinRounds + CryptoTransform.MaxAdditionalRounds);

            plans.ForEach((EncodingPlan plan) => {
                block = encoder.EncodeBlock(plan, block);
                block = encoder.DecodeBlock(plan, block);
                CollectionAssert.AreEqual(block, copy);
            });
        }