Crypto – Transposition
Explain
It seems that the simple substitution ciphers are too easy for you.
From my own experience I can tell that transposition ciphers are more difficult to attack.
However, in this training challenge you should have not much problems to reveal the plaintext.
Ciphertext
oWdnreuf.lY uoc nar ae dht eemssga eaw yebttrew eh nht eelttre sra enic roertco drre . Ihtni koy uowlu dilekt oes eoyrup sawsro don:wp ropglddpel.f
여러가지 암호화 기법이 있지만,
이를 복호화 하기 위해선 첨부된 http://en.wikipedia.org/wiki/Transposition_cipher에서 전위 암호의 정의를 보면,
In cryptography, a transposition cipher is a method of encryption by which the positions held by units of plaintext
전위 암호화는 단순히 글자들의 위치만을 바꾸어 쉽게 알아보게 하지 못하는 방식을 췽한다.
문제에 나온 암호화된 문장의 첫 시작인 “oWdnreuf.l”을 제조합 하면 Wonderful이 된는데,
2글자씩 위치가 변경(Transposition)되어 암호화 된 것이다. 즉, key가 ‘2’이라면 ‘2’글자씩 순서를 뒤바꾸는 형식인것이다.
이 방식을 역으로 이용해 거꾸로 key의 수씩 거꾸로 출력하하는 코드를 짜면 아래와 같다.
def decrypt(ciphertext, key): plainText = "" ciphertext= list(ciphertext) for _ in range( round(len(ciphertext)/key + 0.5) ): dump = ciphertext[:key] plainText += ''.join(dump[::-1]) del ciphertext[:key] return plainText ciphertext = "oWdnreuf.lY uoc nar ae dht eemssga eaw yebttrew eh nht eelttre sra enic roertco drre . Ihtni koy uowlu dilekt oes eoyrup sawsro don:wp ropglddpel.f" key = 2 print(decrypt(ciphertext, key))
이 코드에 위에서 주어진 암호문을 넣고 실행 시키면,
Wonderful. You can read the message way better when the letters are in correct order. I think you would like to see your password now: porgpdlpdlef.
가 출력된다.