ssongk
ssongk
ssongk
전체 방문자
오늘
어제

공지사항

  • resources
  • 분류 전체보기 (626)
    • CTF (24)
    • background (79)
      • fuzzing (5)
      • linux (29)
      • linux kernel (15)
      • windows (2)
      • web assembly (1)
      • embedded (0)
      • web (13)
      • crypto (9)
      • mobile (1)
      • AI (1)
      • etc.. (3)
    • write-up(pwn) (171)
      • dreamhack (102)
      • pwn.college (4)
      • pwnable.xyz (51)
      • pwnable.tw (3)
      • pwnable.kr (5)
      • G04T (6)
    • write-up(rev) (32)
      • dreamhack (24)
      • reversing.kr (8)
    • write-up(web) (195)
      • dreamhack (63)
      • LOS (40)
      • webhacking.kr (69)
      • websec.fr (3)
      • wargame.kr (6)
      • webgoat (1)
      • G04T (7)
      • suninatas (6)
    • write-up(crypto) (19)
      • dreamhack (16)
      • G04T (1)
      • suninatas (2)
    • write-up(forensic) (53)
      • dreamhack (5)
      • ctf-d (47)
      • suninatas (1)
    • write-up(misc) (13)
      • dreamhack (12)
      • suninatas (1)
    • development (31)
      • Linux (14)
      • Java (13)
      • Python (1)
      • C (2)
      • TroubleShooting (1)
    • 자격증 (8)
    • 이산수학 (1)
    • 정보보안 (0)
hELLO · Designed By 정상우.
ssongk

ssongk

[CryptoHack | DreamHack] Chinese Remainder Theorem (중국인의 나머지 정리)
background/crypto

[CryptoHack | DreamHack] Chinese Remainder Theorem (중국인의 나머지 정리)

2023. 7. 6. 15:41

크립토핵 설명보다 드림핵 설명이 이해하기 쉬웠다.

dreamhack.io

 


연습문제는 다음과 같다.

x ≡ 2 mod 5
x ≡ 3 mod 11
x ≡ 5 mod 17

# Find the integer a such that x ≡ a mod 935

 
다음과 같이 풀 수 있다.

from Crypto.Util.number import inverse

p1 = 5
p2 = 11
p3 = 17
c1 = 2
c2 = 3
c3 = 5

m = p1*p2*p3

m1 = m // p1
m2 = m // p2
m3 = m // p3
n1 = inverse(m1, p1)
n2 = inverse(m2, p2)
n3 = inverse(m3, p3)

x = pow(c1*m1*n1 + c2*m2*n2 + c3*m3*n3, 1, m)
print(x)

 
또 다른 문제로는 드림핵의 chinese what? 문제가 있다.
https://dreamhack.io/wargame/challenges/660/

chinese what?

CRT는 rsa에 많이 응용되는 정리입니다. 간단한 문제를 풀어보며 CRT란 무엇인지 알아보세요.

dreamhack.io

 


레퍼런스
https://cryptohack.org/courses/modular/crt1/

CryptoHack – Home

A fun, free platform to learn about cryptography through solving challenges and cracking insecure code. Can you reach the top of the leaderboard?

cryptohack.org

https://learn.dreamhack.io/76#8

로그인 | Dreamhack

dreamhack.io

 
 

'background > crypto' 카테고리의 다른 글

[CryptoHack] Modular Square Root (Tonelli-Shanks algorithm)  (0) 2023.07.06
[CryptoHack] Legendre Symbol (르장드르 기호)  (0) 2023.07.04
[CryptoHack] Quadratic Residues (제곱 잉여)  (0) 2023.07.01
[CryptoHack] Modular Inverting (모듈로 역수)  (0) 2023.07.01
[CryptoHack] Modular Arithmetic 2  (0) 2023.07.01
    'background/crypto' 카테고리의 다른 글
    • [CryptoHack] Modular Square Root (Tonelli-Shanks algorithm)
    • [CryptoHack] Legendre Symbol (르장드르 기호)
    • [CryptoHack] Quadratic Residues (제곱 잉여)
    • [CryptoHack] Modular Inverting (모듈로 역수)
    ssongk
    ssongk
    벌레 사냥꾼이 되고 싶어요

    티스토리툴바