Bytes and Big Integers

2023. 1. 31. 18:12·Wargame/Cryptohack
728x90
반응형

1. intro

2. code 및 분석

2.1.  code

N/A

 

2.2. 분석

마찬가지로 해석해보면,

RSA와 같은 cryptosystem은 숫자로 작동한다.

하지만 메시지는 문자로 이루어져있다.

수학적 연산이 적용될 수 있도록 어떻게 우리의 메시지를 숫자로 변경해야할까.

 

가장 일반적인 방법은, 메시지를 hex로 바꾸고, 합치고, 10진수로 변환하는 것이다.

이는 16진수 또는 10진수로 표현할 수 있다.

 

이 문제는 pycryptodome의 사용법에 대한 팁을 주는 정도인 것 같다.

 

3. exploit

하지만 나는 그렇게 풀지 않긔.

직접 풀어보고 함수 써볼거임 ㅋㅋㅋ

e = 11515195063862318899931685488813747395775516287289682636499965282714637259206269
d = ''

b16 = hex(e)[2:]

for i in range(0,len(b16),2):
    d += chr(int(b16[i:i+2],16))

print(d)

 

┌──(kali㉿kali)-[~/Downloads]
└─$ python solve.py 
crypto{3nc0d1n6_4ll_7h3_w4y_d0wn}

 

이제 함수를 통한 풀이.

from Crypto.Util.number import *

e = 11515195063862318899931685488813747395775516287289682636499965282714637259206269
d = ''

d = long_to_bytes(e)

print(d)

 

┌──(kali㉿kali)-[~/Downloads]
└─$ python solve.py
b'crypto{3nc0d1n6_4ll_7h3_w4y_d0wn}'
728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Wargame > Cryptohack' 카테고리의 다른 글

XOR properties  (0) 2023.01.31
XOR Starter  (0) 2023.01.31
Base64  (0) 2023.01.31
Hex  (0) 2023.01.31
ASCII  (0) 2023.01.31
'Wargame/Cryptohack' 카테고리의 다른 글
  • XOR properties
  • XOR Starter
  • Base64
  • Hex
wyv3rn
wyv3rn
아저씨의 흔한 취미. wyv3rn#1249
  • wyv3rn
    think storage
    wyv3rn
  • 전체
    오늘
    어제
    • 분류 전체보기 (520)
      • To do list (7)
        • Doing (1)
        • Complete (6)
      • Diary (35)
      • Tips & theory (75)
      • Kernel Exploit (28)
        • Theory (16)
        • Exercise (5)
      • File Structure (6)
      • Wargame (322)
        • pwn.college (34)
        • Dreamhack (156)
        • pwnable.kr (15)
        • Lord of Sqlinjection (4)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (46)
        • Solved (44)
        • Unsolved (2)
      • Script (0)
      • RubiyaLap (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • PWN wargame 모음 (및 느낀점)
    • 비공개 글들에 대해.
    • 뭐라도 하나 얻어가시길...
  • 인기 글

  • 태그

    la ctf
    root-me
    hackerschool
    libc
    phoenix
    lob
    rop
    FSB
    Me
    Buffer Overflow
    pwnable.kr
    docker
    pwntools
    Format String Bug
    x64
    cryptohack
    dreamhack
    vtable
    heap
    root
    exploit education
    _IO_FILE
    BOF
    x86
    32bit
    ROOT ME
    64bit
    tcache
    RTL
    CANARY
  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
wyv3rn
Bytes and Big Integers
상단으로

티스토리툴바