crypto

Cyber Apocalypse 2024

Dynastic

Solved by : Starry-lord

This challenge comes with an output.txt and a python source as you can see below:

    from secret import FLAG
    from random import randint
    
    def to_identity_map(a):
        return ord(a) - 0x41
    
    def from_identity_map(a):
        return chr(a % 26 + 0x41)
    
    def encrypt(m):
        c = ''
        for i in range(len(m)):
            ch = m[i]
            if not ch.isalpha():
                ech = ch
            else:
                chi = to_identity_map(ch)
                ech = from_identity_map(chi + i)
            c += ech
        return c
    
    with open('output.txt', 'w') as f:
        f.write('Make sure you wrap the decrypted text with the HTB flag format :-]\n')
        f.write(encrypt(FLAG))

We needed to write a decryption mechanism for this, taking the output file as input. Here’s my solution:

HTB{DID_YOU_KNOW_ABOUT_THE_TRITHEMIUS_CIPHER?!_IT_IS_SIMILAR_TO_CAESAR_CIPHER}
Published on : 16 Mar 2024