public_key_cryptography course - challenges 3 - Euler's totent.

This commit is contained in:
boyreau 2026-11-05 12:09:50 +01:00
commit c72e3335ea
2 changed files with 9 additions and 2 deletions

View file

@ -1,8 +1,13 @@
# Challenge PK-crypto-1
def modular_exponentiation():
def modular_exponentiation() -> int:
return pow(101, 17, 22663)
# Challenge PK-crypto-2
def basic_encryption(message: int, p: int, q: int):
def basic_encryption(message: int, p: int, q: int) -> int:
return pow(message, 0x10001, p * q)
# Challenge PK-crypto-3
def Euler_totient(p: int, q: int) -> int:
return (p - 1) * (q - 1)