IN JAVA:
General explanation:
For your implementation you will perform 16 rounds. You willspecify a 9 bit key. A 12-bit value is passed into a simplified DESalgorithm and is immediately split into two 6-bit values. Since theASCII system represents characters as 8-bit values we must pass 1½ASCII characters into our system. Since there are no ½ characterswe will process 3 characters (24 bits) at a time calling the systemtwice (12 bits each call.)
What to do:
Write a function that receives a sequence of ASCII characters(this can be a Java String object or an array of byte primitives,your choice), breaks it up into 3- character subsequences. Each3-character subsequence is then split into two 12-bit values. Each12-bit value will be split into two 6-bit values by your Simple DESsystem. The result will be the cipher (encrypted) or plain(decrypted) text depending on which “direction” you are processing.If the input data length is not a multiple of 3 you should pad itwith null characters (0).
Demonstrate your system by encrypting and decrypting thefollowing character strings:
• ABC
• ABCD
• ABCDE
• The cat sleeps on the tree.
For example, your code may look as such:
short key = 0b010101010
byte cipher[] = encrypt(“ABC”.getBytes(), key);
byte plain[] = decrypt(cipher, key);
for (byte b : plain) {
System.out.print(b + “ “);
}
Do this for the 4 specified test strings.
IN JAVA: General explanation: For your implementation you will perform 16 rounds. You will specify a 9 bit key. A 12-bit
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am