Easy Peasy
Tags: picoCTF 2021
, cryptography
Description:
A one-time pad is unbreakable, but can you manage to recover the flag? (Wrap with picoCTF{}). nc mercury.picoctf.net 36449
one-time pad is unbreakable only if you don't use the same key twice. this code is like sliding window next message is encrypted from the end of last messages length in key file and we can find the loop hole in this part of the code.
If length is greater than key it will start from zero so we can encrypt our message with same key used to encrypt flag and we are given the encrypted flag. To make stop = 0 length of message = length of key – length of flag
length of key = 50000
length of flag = (encrypted flag/2)
encrypted flag = flag xor key
encrypted message = (known message) xor key
so we can find key with,
key = (known message) xor (encrypted message)
and flag = (encrypted flag) xor key
here is python script to find flag:
Last updated
Was this helpful?