Skip to main content

ELITE?

Viewing 15 posts - 76 through 90 (of 92 total)
  • Author
    Posts
  • #53348
    Ace661
    Participant

    @F6exb

    May be I don’t understand very well but it seems to me that in your two last messages you write as if you were not very sure.

    Yes, I have been able to decrypt this challenge, but I am rarely sure – I always consider that the method I used may not be the only option, and if so it may therefore not be the best option. If someone else is tackling it from a different perspective, any clues about my method may not be helpful.

    #53349
    F6exb
    Participant

    Yes, I noticed the codeword from the begining, but my mistake came because “Baudot” is also used for ITA2. In ham radio world we call the code used for RTTY “Baudot code”. Maybe by “abus de langage” (I don’t know how to say in english).

    Same thing here at the bottom of the page :
    http://www.wavecom.ch/content/ext/DecoderOnlineHelp/default.htm#!worddocuments/baudot.htm

    Now, I am going back to the challenge.

    #53350
    Madness
    Participant

    No, no, no, no, NO!
    Do not take advice fromt wavecom.ch.
    Original Baudot code is 5-bit.

    #53351
    F6exb
    Participant

    OK. I Wanted only to show that there are mistakes everywhere with the word “Baudot” and that it is used sometimes for ITA1 or for ITA2.

    About wavecom.ch:
    ITA2 is also a 5 bits code but to synchronise both teletype writers, at the time of transmission a start bit is added before the 5 bits of data and 1.5 or 2 bits stop bits are added at the end. So they said “giving each character a length of 7, 7.5 or 8 bits”.
    I don’t confuse: letters are coded with 5 bits.

    About the challenge, I get a lot of garbage. To be sure :
    The ciphertext is punched on a tape, LSB on top.
    I cut the tape every 5 characters.
    Each block of 5 is rotaded clockwise (or counterclockwise).
    The transcription is read vertically LSB on top.
    The transcription is translated in plaintext with ITA1 code.

    PS: Has everybody left the forum?

    Baudot

    #53353
    Ace661
    Participant

    @F6exb – there are only two possible options, not hundreds, so just try both!

    This step will only get you part of the way to the plaintext – Madness has already given all the necessary details.

    #53356
    F6exb
    Participant

    I am so sorry for everyone who gave clues but I failed to write a program to translate five bits characters to printable characters using Baudot-UK.
    I can decrypt normal letters and punctuation but can’t manage spaces and cancels. So I never got a ciphertext usable for a last decrypt stage.
    I know that there is a library in Python, but I wanted to write my own program and I’m using PureBasic.
    May be I’ll improve my programing skills for the next challenge.
    Thank you everybody.

    #53357
    F6exb
    Participant
    #53358
    F6exb
    Participant

    Sorry, for Coldplay it is ITA2. Harry can you correct my precedent message please ?

    [Sorry, bit busy this morning! Harry]

    #53359
    Mattyrat2027
    Participant

    @Everyone I look forward to seeing a method of decrypt, I’d rather try and solve it with the necessary steps rather than just look at the decrypt…

    If there is somewhere I can find this, do say.

    Thanks for a brilliant few months!

    #53352
    Madness
    Participant

    Didn’t I say there is still a substitution after the rotation?

    #53360
    F6exb
    Participant
    #53361
    Mattyrat2027
    Participant

    Thanks, @F6exb.


    @Madness
    I read the method at the bottom, but I don’t understand how the rotated baudot can then be converted. Surely the dots are in the wrong place?

    #53362
    F6exb
    Participant
    #53363
    Madness
    Participant
    
    #!/usr/bin/env python3
    # -*- coding: utf-8 -*-
    
    null = "█"
    shift = "↑"
    space = "_"
    alphabet = null+"AE/YUIO"+shift+"JGHBCFD"+space+"-XZSTWV*KMLRQNP"
    latin = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    
    def keyword_to_key(keyword):
        key = ""
        for char in keyword+latin:
            if char not in key:
                key += char
        return key
    
    def encrypt_stage1(p,keyword):
        key = keyword_to_key(keyword)
        c = ""
        for char in p.replace(" ",space):
            if char in latin:
                c += key[latin.index(char)]
            else:
                c += char
        return c
    
    def int_to_bits(n):
        bits = []
        for _ in range(5):
            bits.append(n&1)
            n //= 2
        return bits[::-1]
    
    def bits_to_int(b):
        result = 0
        for bit in b[::]:
            result *= 2
            result += bit
        return result
    
    def encrypt_stage2(p):
        c = ""
        while len(p) > 0:
            block = [x for x in p[:5]]
            p = p[5:]
            for i in range(5):
                block[i] = int_to_bits(alphabet.index(block[i]))
            for i in range(5):
                bits = []
                for j in range(5):
                    bits.append(block[j][i])
                c += alphabet[bits_to_int(bits)]
        return c
    
    def encrypt(p,keyword):
        while len(p)%5 != 0:
            p += space
        c = encrypt_stage1(p,keyword)
        c = encrypt_stage2(c)
        return c
    
    def decrypt_stage2(c):
        bits = []
        for char in c:
            bits += int_to_bits(alphabet.index(char))
        p = ""
        for i in range(len(bits)//25):
            block = bits[25*i:25*i+25]
            newblock = []
            for j in range(5):
                for k in range(5):
                    newblock.append(block[k*5+j])
            for j in range(5):
                p += alphabet[bits_to_int(newblock[5*j:5*j+5])]
        return p
    
    def decrypt_stage1(c,keyword):
        key = keyword_to_key(keyword)
        p = ""
        for char in c:
            if char in latin:
                p += latin[key.index(char)]
            else:
                p += char
        return p
    
    def decrypt(c,keyword):
        p = decrypt_stage2(c)
        p = decrypt_stage1(p,keyword)
        return p.replace(space," ")
    
    if __name__ == "__main__":
        from sys import argv
        if len(argv) != 4:
            print("usage: "+argv[0]+" encrypt|decrypt <keyword> <text>")
            exit()
        keyword = argv[2].upper()
        text = argv[3].upper()
        if argv[1][:3] == "enc":
            result = encrypt(text,keyword)
        elif argv[1][:3] == "dec":
            result = decrypt(text,keyword)
        print(result)
    
    #53365
    F6exb
    Participant

    Dear uncle Madness,
    Thank you very much for your program. I learned a lot trying to read it. It works well and I can encrypt or decrypt a plain text. If I give it a text to encrypt, It give me a cipher text which is decrypted back in the same plain text.

    BUT:

    – If I feed it with “DEAR UNCLE WILHELM…” the output isn’t “-ISWM WR_FA L█CO█ CU█FW L……” and reciprocally, I don’t see my uncle.

    – You said on Github that “The alphabet was mixed with the Wheatston prescription from keyword FAILURE.”
    The output of the procedure ” keyword_to_key(keyword)”, with FAILURE as keyword is:
    FAILUREBCDGHJKMNOPQSTVWXYZ
    which I think isn’t a mixing using Wheatstone’s prescription but rather a classical method. (document REPORT SP-013 METHODS OF MIXING KEYS which was before in the current case files).

    – If I comment ” #p = decrypt_stage1(p,keyword)” in the procedure decrypt(c,keyword) I can decrypt “-ISWM WR_FA…” but with a key which is a transposition of the Latin alphabet.

    Is all that correct?

Viewing 15 posts - 76 through 90 (of 92 total)
  • You must be logged in to reply to this topic.