Post

Wechall - Baconian

Encodings - Baconian



1
2
3
4
5
6
7
In this training challenge 
you have to reveal a hidden message inside another message.
It is known that the message is hidden via Bacon cipher.

Again the solution changes for every session and consists of 12 random characters.

Enjoy!






Solution



Bacon cipher는 각각의 알파벳을 a와 b로 나타낸 암호임.

우선 메시지에는 대문자와 소문자가 있음. 여기서 대문자는 a로 소문자는 b로 치환한 뒤에 version2에 맞춰서 치환을 해 보았음.

하지만 알아볼 수 없는 값만 나옴. 그래서 온라인 디코더로 해보니 숨겨진 메시지가 나왔음.


알아보니 a,b로 치환한 뒤에 여기서 4가지로 구분해서 암호화를 함.


  1. A, B = A, B , VERSION 1

  2. A, B = A, B , VERSION 2

  3. A, B = B, A , VERSION 1

  4. A, B = B, A , VERSION 2


이 문제에서는 4번을 사용한 것임. 따라서 코드를 수정해서 풀면 성공.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
ctext="""ababa bbabb abbba aabbb abaaa abaab bbabb babaa babaa abaaa bbbaa baaab baaba bbabb abaaa bbaba bbabb babaa babaa baaab abaab abaaa bbaaa bbbbb bbbab babab bbabb abbba 
abaaa abbaa bbaaa bbabb abaaa abbab bbabb bbbab abbba bbabb abbaa abaaa babab bbabb aabbb abaab baaab abbba bbbaa abaaa babbb abbab abaaa bbbab bbbab bbbab baaaa bbabb bbbab 
bbbbb bbaba baaaa bbaba baabb bbbba abaaa abaaa babab ababa bbaba babab aabab abbab ababb aabab aaaba babba baaab ababb abaab aabab babab abaab abaab ababb abbba baaba abaab 
aabab ababa bbaba baaba bbaba abaab babba babab abbab ababa bbabb abaab ababa babaa babab abaaa babaa babab aabab babba baaba babba ababa baabb abbaa baabb abbaa bbabb ababa 
babaa babab ababb ababa babba bbaba babab baaba babab aabba bbabb ababb ababa ababb ababa abbab babab babab abbab aabba babab abbaa baaba babab abaab ababa babab ababa abbab 
ababb aabab abbab baaab bbabb ababa abaab ababa babba babab babab aabba babab ababa babab ababa babba abaab abaab ababa abbab ababa ababb aaaba ababa babab ababa babba ababa 
babba baaab abbab ababa ababa babba ababb abaab babab abbab babab abaab ababa babba babaa bbaba babba bbaba babba baaba babba bbaba babaa babab ababa babaa baaba bbaba babab 
babba ababb abbab babab babab ababa bbaba babba babab aaaba babab aabab ababa baaba babab abaab ababa abaab abaab ababa ababb abaab ababb abbab ababa babba babab aabba ababb 
aaaba abaab abaab babab babba babab abbaa bbaba babab abbab abbaa baabb ababa babba babab ababa baaba babab abaab babab abaab ababa abaab ababa abbab babab babab aabaa bbaba 
abbab abbab babab ababa bbaba baaba babaa bbaba babab abbab abaab babab babab abaab abaab ababa abaab baaba ababa abaab abbab babab abaaa babab babab abbaa babba bbaba ababa 
ba""".split()

ctext_2=[]
for i in ctext :
    s=''
    for j in i :
        if j == 'a' :
            s+='b'
        else :
            s+='a'
    ctext_2.append(s)

for i in ctext_2:
    if i == 'aaaaa' :
        print('A', end='')
    elif i == 'aaaab':
        print('B', end='')
    elif i == 'aaaba':
        print('C', end='')
    elif i == 'aaabb':
        print('D', end='')
    elif i == 'aabaa':
        print('E', end='')
    elif i == 'aabab':
        print('F', end='')
    elif i == 'aabba':
        print('G', end='')
    elif i == 'aabbb':
        print('H', end='')
    elif i == 'abaaa':
        print('I', end='')
    elif i == 'abaab':
        print('J', end='')
    elif i == 'ababa':
        print('K', end='')
    elif i == 'ababb':
        print('L', end='')
    elif i == 'abbaa':
        print('M', end='')
    elif i == 'abbab':
        print('N', end='')
    elif i == 'abbba':
        print('O', end='')
    elif i == 'abbbb':
        print('P', end='')
    elif i == 'baaaa':
        print('Q', end='')
    elif i == 'baaab':
        print('R', end='')
    elif i == 'baaba':
        print('S', end='')
    elif i == 'baabb':
        print('T', end='')
    elif i == 'babaa':
        print('U', end='')
    elif i == 'babab':
        print('V', end='')
    elif i == 'babba':
        print('W', end='')
    elif i == 'babbb':
        print('X', end='')
    elif i == 'bbaaa':
        print('Y', end='')
    elif i == 'bbaab':
        print('Z', end='')
print()


출력 값에서 숨겨진 메시지 부분만 보면 아래와 같음.
VERYXWELLXDONEXFELLOWXHACKERXTHEXSECRETXKEYWORDXISXCCCPECAFPFMBX
CCCPECAFPFMB






This post is licensed under CC BY 4.0 by the author.