Fiestel cipher

profileHumus

4. Have a function with the name "feistel_enc" that accepts up to 16 bytes long byte-sequence as its first argument, an integer (specifying the number of rounds) as its second argument, and an integer (specifying the seed value for the key generation) as its third argument and returns a 16 bytes long encrypted byte-sequence. e.g., function call: feistel_enc(b'isthis16bytes?',16,50) should return a byte-sequence b'}\xd9\x93-G\x8e\xaa5\x95\x84\n\xb7q\xc4>\xb6'

5. Have a function with the name "feistel_dec" that accepts up to 16 bytes long byte-sequence as its first argument, an integer (specifying the number of rounds) as its second argument, and an integer (specifying the seed value for the key generation) as its third argument and returns a 16 bytes long decrypted byte-sequence. e.g., function call: feistel_dec(b'}\xd9\x93-G\x8e\xaa5\x95\x84\n\xb7q\xc4>\xb6',16,50) should return a byte-sequence b'isthis16bytes?  ' or b'isthis16bytes?\x20\x20'

6. Write your own test code (if any) in the "__main__" if block and not outside the functions.

  • 3 years ago
  • 10
Answer(0)