Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jvdsn
GitHub Repository: jvdsn/crypto-attacks
Path: blob/master/attacks/rsa/low_exponent.py
2589 views
1
from sage.all import ZZ
2
3
4
def attack(e, c):
5
"""
6
Recovers the plaintext from a ciphertext, encrypted using a very small public exponent (e.g. e = 3).
7
:param e: the public exponent
8
:param c: the ciphertext
9
:return: the plaintext
10
"""
11
return int(ZZ(c).nth_root(e))
12
13