Beispiel #1
0
        public void SetPlane_ShouldSetPlaneBits()
        {
            var state = new SpongeState(new BitString("10101010101010101010101010101010101010101010101010"), 25);
            var plane = state.GetPlane(0);

            state.SetPlane(plane, new[] { false, true, false, true, false, true, false, true, false, true });
            Assert.AreEqual("01010101011010101010101010101010101010101010101010", state.ToBinString());
        }
Beispiel #2
0
        public void XorPlane_ShouldPerformBitwiseXorWithBits()
        {
            var state = new SpongeState(new BitString("10101010101010101010101010101010101010101010101010"), 25);
            var plane = state.GetPlane(0);
            var bits  = new[] { true, true, true, true, true, true, true, true, true, true };

            state.XorPlane(plane, bits);
            Assert.AreEqual("01010101011010101010101010101010101010101010101010", state.ToBinString());
        }
Beispiel #3
0
        public void GetPlane_ShouldReturnExpectedPlane()
        {
            var state = new SpongeState(new BitString("10101010101010101010101010101010101010101010101010"), 25);

            for (var y = 0; y < 5; y++)
            {
                var plane = state.GetPlane(y);
                var z     = 0;

                foreach (var row in plane.GetRows())
                {
                    var rowCheck = (z & 1) == 0
                                        ? row.GetBits().All(b => b)
                                        : row.GetBits().All(b => !b);

                    Assert.IsTrue(rowCheck);
                    z++;
                }
            }
        }