18 lines
433 B
Python
18 lines
433 B
Python
# Challenge PK-crypto-1
|
|
def modular_exponentiation() -> int:
|
|
return pow(101, 17, 22663)
|
|
|
|
|
|
# Challenge PK-crypto-2
|
|
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)
|
|
|
|
|
|
# Challenge PK-crypto-4
|
|
def private_key(p: int, q: int, exp: int) -> int:
|
|
return pow(exp, -1, (p - 1) * (q - 1))
|