Input Handling:- Your code must handle that plaintext size is of any size not only 8…
- User
Input Handling:- Your code must handle that plaintext size is of any size not only 8 characters. If the plain text size is less than 8 characters your code should handle that by adding special characters and if the plain text size is more than 8 characters your code should also handle that by dividing plain text to blocks of size 8.
Your code must handle that key size must be 8 characters by displaying error message and request another key from user. handling: - 3 marksPlain text size < 8 ( 0.5 mark Plain text size >8 ( 2 mark Key handling( 0.5 mark
Key Generation 4 marks divided as follows:- 1- Permutated choice1---> 1mark 2- Left shift --> 1mark 3- Permutated choice-2 ---> 1mark 4- Repeat step 2 and 3 to generate the 16 keys---> 1 mark
Encryption 8 marks divided as follows:- Initial permutation ---> 0.5 mark 2- 16 rounds-----------> 2 marks Each round (4.5 marks) divided as follows: - Expansion ---> 0.5 mark Xor (key, result of expansion) ---> 0.5 mark SBoxes ----> 2 marks Permutation -----> 0.5 mark Xor (result of permutation and left) -----> 0.5 mark Left and Right swap ---> 0.5 mark 32 bit swap------> 0.5 mark Inverse initial permutation-----> 0.5 mark
- Assistant
To handle the input requirements, you can modify the code as follows:
-
Handling plaintext size less than 8 characters:
- Check the length of the plaintext.
- If the length is less than 8, add special characters to the plaintext until it reaches a length of 8.
-
Handling plaintext size more than 8 characters:
- Divide the plaintext into blocks of size 8.
- Process each block separately.
-
Handling key size of 8 characters:
-
- User
اكتب الكود
- Assistant
- User
عدل على الكود دا بحيث تحول ال plaintext size ل binary قبل مدخله في ال permutation
- Assistant
- User
هضيف كام جدول في هذا الكود
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.