일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- N0Named
- 슬퍼유
- 네트워크관리사2급
- 네트워크 보안
- 윈도우 프로세스
- 윈도우 프로세스 종류
- Multimedia
- 2022시작
- memory
- 생활코딩
- 디지털포렌식 with CTF
- 정보처리기사 필기 합격
- 포렌식
- 실기
- ftz
- vinetto
- html
- pythonchallenge
- 생활코딩 html
- blkls
- CTF-D
- 디지털포렌식
- 는 하지마...
- Multimeida
- ZIP 파일구조
- slack space
- Window process
- disk
- 24시간의 전사
- network
- Today
- Total
ssoL2 TISTORY
[암호와 해킹] first_encrptor.py 본문
CodeBook 에 대해 변환, CodeBook에 존재하지 않는 단어는 그대로 노출 '9':'m','*':'n','%':'o','=':'p','(':'r',')':'s',';':'t','?':'u','@':'v',':':'y','7':' '} |
def makeCodebook() : decBook = {'5':'a', '2':'b','#':'d', '8':'e','1':'f','3':'g','4':'h','6':'i','0':'l',\ '9':'m','*':'n','%':'o','=':'p','(':'r',')':'s',';':'t','?':'u','@':'v',':':'y','7':' '}
encBook = dict()
for x,y in decBook.items() : encBook[y] = x
return encBook, decBook
def encoding(msg, encBook) : for i in msg : if i in encBook : msg = msg.replace(i, encBook[i]) return msg
def decoding(msg, decBook) : for i in msg : if i in decBook : msg = msg.replace(i, decBook[i]) return msg #main
if __name__ == '__main__' : plainText = input()
encBook, decBook = makeCodebook()
cipherText = encoding(plainText, encBook) print(cipherText)
decipherText = decoding(cipherText, decBook) print(decipherText) |