public_key_cryptography course - challenges 5 - decryption
This commit is contained in:
parent
ac83990bc9
commit
15131cf4fa
2 changed files with 8 additions and 0 deletions
|
|
@ -16,3 +16,9 @@ def Euler_totient(p: int, q: int) -> int:
|
|||
# Challenge PK-crypto-4
|
||||
def private_key(p: int, q: int, exp: int) -> int:
|
||||
return pow(exp, -1, (p - 1) * (q - 1))
|
||||
|
||||
|
||||
# Challenge PK-crypto-5
|
||||
def decode(p: int, q: int, exp: int, c: int):
|
||||
pk = private_key(p, q, exp)
|
||||
return pow(c, pk, p * q)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue