CSCAMP CTF 2014 - Logic (Crypto)

1 minute read

Message encoded in a seven segment display LED format.

Challenge

Points

150

Description

01100000-11110010-11110010-11100001
hint: use the LED

Solution

At first, I thought LED mean Logical Error Detection so we almost got banned for that category trying the possibilities :P

But 50 minutes before the competition ended, I got a brainwave and realised that the hint was referring to a Seven Segment Display..

The assembled image Seven segment display

So I wrote this script to translate the encoded message for me using the abcdefg scheme. Basically, we take the first seven bits as the main on/off flags for the lighted segments of the number and the last bit as the on/off flag for the decimal point.

#!/usr/bin/python

def main():
    data = "01100000-11110010-11110010-11100001"

    transformation_table = {
    0x7e: '0', 0x30: '1', 0x6d: '2',
    0x79: '3', 0x33: '4', 0x5b: '5',
    0x5f: '6', 0x70: '7', 0x7f: '8',
    0x7b: '9', 0x77: 'A', 0x1f: 'b',
    0x4e: 'C', 0x3d: 'd', 0x4f: 'E',
    0x47: 'F'}

    values = [(int(i[:7], 2), int(i[7])) for i in data.split('-')]

    flag = ""

    for i in values:
        flag += transformation_table[i[0]]
        flag += "." if i[1] else ""

    print "Flag: %s" % flag

if __name__ == "__main__":
    main()

The result of running my script:

amon@Evanna$ python solve.py
Flag: 1337.

Flag: 1337.

Leave a Comment