public void ShouldThrowArgumentExceptionIfGetSubArrayDimension1IndexLtZero() { var subject = new Array3D(_working3DArray); Assert.Throws( typeof(ArgumentException), () => subject.GetSubArray(-1) ); }
public void ShouldPullOutProperSubArrayStatic() { var subArray = Array3D.GetSubArray(_working3DArray, 1); var expectedResults = new Array2D(new byte[3, 4] { { 13, 14, 15, 16 }, { 17, 18, 19, 20 }, { 21, 22, 23, 24 } }); Assert.AreEqual(expectedResults.Array, subArray); }
private void Decrypt(byte[,] block) { var roundKey = Array3D.GetSubArray(_keySchedule.Schedule, _keySchedule.Rounds); var blockCount = _keySchedule.BlockCount; KeyAddition(block, roundKey, blockCount); Substitution(block, RijndaelBoxes.Si, blockCount); ShiftRow(block, 1, blockCount); for (int round = _keySchedule.Rounds - 1; round > 0; round--) { roundKey = Array3D.GetSubArray(_keySchedule.Schedule, round); KeyAddition(block, roundKey, blockCount); InvMixColumn(block, blockCount); Substitution(block, RijndaelBoxes.Si, blockCount); ShiftRow(block, 1, blockCount); } roundKey = Array3D.GetSubArray(_keySchedule.Schedule, 0); KeyAddition(block, roundKey, blockCount); }
private void Encrypt(byte[,] block) { var roundKey = Array3D.GetSubArray(_keySchedule.Schedule, 0); var blockCount = _keySchedule.BlockCount; KeyAddition(block, roundKey, blockCount); for (int round = 1; round < _keySchedule.Rounds; round++) { Substitution(block, RijndaelBoxes.S, blockCount); ShiftRow(block, 0, blockCount); MixColumn(block, blockCount); roundKey = Array3D.GetSubArray(_keySchedule.Schedule, round); KeyAddition(block, roundKey, blockCount); } Substitution(block, RijndaelBoxes.S, blockCount); ShiftRow(block, 0, blockCount); roundKey = Array3D.GetSubArray(_keySchedule.Schedule, _keySchedule.Rounds); KeyAddition(block, roundKey, blockCount); }
public void ShouldReturnNullOnExceptionStaticSubArray() { var result = Array3D.GetSubArray(_working3DArray, -1); Assert.IsNull(result); }