Lab 6 (05/04/2023
)
Problems for lab session:
Practicals
Use the following plaintext for encryption in the following questions:
Plaintext: 2210ModernCrypto
Part-1:
- Define a function
strToBin()
to perform the following operation:- Convert any string (of bytes or char.) to a binary string
- Use the ASCII values for intermediate operation
- Each char. MUST be converted to the 8-bit binary string
- Define a function
binToStr()
to perform the following operation:- Convert any binary string to ASCII char. string
- Each char. MUST be retrieved from the sets of 8-bit binary string
Part-2:
- Implement the Feistel Cipher algorithm for data-encryption with the following properties:
- The complete plaintext MUST be converted to a binary string before the operation
- The entire plaintext should be split only in two halves viz left half (L1) and right half (R1)
- The algorithm MUST use two random keys K1 and K2 generated using
LinearCongruentialGenerator()
- There MUST be exactly three rounds for encryption