Question: Create a class named ShiftRows.java. The code will perform 1 step of the AES ( Advanced Encryption Standard ) round function. Background The Rijndael Algorithm

Create a class named ShiftRows.java. The code will perform 1 step of the AES (Advanced
Encryption Standard) round function.
Background
The Rijndael Algorithm was selected in 2000 as the Advanced Encryption Standard in the United
States (See FIPS197). It won a competition against more than 15 other competing encryption
algorithms.
The algorithm is involved performing several different operations each 'round' (iteration) to
scramble data. One of the simpler steps in each round is an operation called ShiftRows. The block
being encrypted is 16 bytes long and it is organized in a 2 dimensional (4xx4) matrix. Each row has a
'circular shift' performed on it by some number of bytes.
The first row is shifted (rotated) by 0 bytes (it is not shifted at all). The second row is shifted by 1
byte to the left. The third row is shifted by 2 bytes and the fourth is shifted by 3.
As an illustration, if the block contained the following before the operation:
After 'ShiftRows', it would be:
You must write a method to implement the ShiftRows operation. It should take a 2 dimensional
array. It will step through and modify the matrix passed to in place so the calling method will see the
modifications after your shift rows method returns.
Here is the prototype
public static void shiftRows(char[][] block);
Note very carefully the element type of the matrix. Since the algorithm works with a block of 168-
bit bytes at a time, we want to make sure the values in the elements do not exceed 255. Actually, we
would want to use a byte since that type is 8 bits but Java forces it to be signed so the value range is
-128 through 127, not 0 through 255. The next best choice is char which is 16 bits. This leaves the
problem that values passed in may exceed 255. So, before doing the shift operations, check each of
the 16 values in the matrix and, if any is less than 0 or greater than 255, print an error message
and exit shiftRows() without changing the matrix content. Also, have the shiftRows() method
verify the size of the rows and columns is correct. Otherwise, have it print an error and return
without changing the matrix.
In addition to writing this method, write a method that will print out the 2 dimensional block in the
form shown above 4 rows of 4 columns.
Write a main method that passes in at least two test blocks with different values. Print the block
before and after the call to verify that the code did the right thing.
Create a class named ShiftRows.java. The code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!