Help cracking CTF

Discussion in 'Community Services' started by HooverBox, 21 Nov 2023.

  1. HooverBox

    HooverBox Active Member

    23 Apr 2020
    Likes Received:
    Hi, I have this CTF challange I am working on since 2 weeks. I was able to solve all other CTFs but this keeps me stuck. If you have some suggestions on how to approach it that would be great. I tried in python, but trying all the possible seconds as seeds is inpractical due to seconds being stored as floats with multiple decimal digits in Python and hence bruteforcing is not doable on CPU without reducing the keyspace. Flags are always in this format: __flag__{3a2b353e13fcd17bf66f1b9bd4b33457}
    42 characters in total and only 32 lowercase alphanumeric between the brackets.
    I attach you the code I tried, it takes around 10 minutes in pycharm on CPU but do not find the flag.
    Here it is:

    Terrific Encryption
    tea.png tea.png
    In a major breakthrough, undergrads at Stanford have unveiled TEA (Terrific Encryption Algorithm) the first quantum-resistant encryption algorithm that can be used on the blockchain. Having learned about the security benefits of TEA, we have immediately encrypted all our flags and are sure that they won't be cracked anytime soon.

    Files included are:

    Select All
    import random import sys import time def encrypt(msg: bytes) -> bytes: cur_time = str(time.time()).encode() random.seed(cur_time) key = [random.randrange(256) for _ in msg] c = [m ^ k for (m, k) in zip(msg + cur_time, key + [0x42] * len(cur_time))] return bytes(c) if __name__ == "__main__": msg = input("Your message: ").encode() enc = encrypt(msg) with open(sys.argv[1], "wb") as f: f.write(enc)

    Attached Files:

    #1 HooverBox, 21 Nov 2023
    Last edited: 21 Nov 2023
    • Like Like x 1

Share This Page