Simplified cipher block-chaining
CodeChefOpen on judge ↗
Ashish has developed his own cipher block-chaining encryption algorithm to boast off in front of his friends. His algorithm is quite simple. Data is represented as an array of integers and is encrypted using following method: C[0] = (msg[0] xor IV) xor K; C[n] = (msg[n] xor C[n – 1]) xor K; for all 0 where C is the array where encrypted cipher is stored, msg is the original data represented as
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start