methods countRepetitions that takes a ciphertext as an argument and returns the total number of repetitions between all 16-byte blocks detectECBMode that takes a ciphertext as input, determines if any repetitions occur, and returns a Boolean value indicating if the ciphertext was encrypted using ECB mode
write in python and use the PyCryptodome library for any cryptographic primitives needed
two methods
countRepetitions that takes a ciphertext as an argument and returns the total number of repetitions between all 16-byte blocks
detectECBMode that takes a ciphertext as input, determines if any repetitions occur, and returns a Boolean value indicating if the ciphertext was encrypted using ECB mode
Your code must display the ECB encrypted ciphertext encoded in the hexadecimal format followed by the number of repetitions (in the following line). For example, if you encounter ten blocks with the same ciphertext, then there are nine repetitions of the 1st block so, the number of repetitions is 9.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images