Created
April 28, 2021 21:22
-
-
Save cbscribe/a5f7e4ed97d29fde0cf55738056fda78 to your computer and use it in GitHub Desktop.
Find a value for D (RSA algorithm)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This program finds a value for D in the RSA algorithm | |
# Given values for A and E | |
A = int(input("A: ")) | |
E = int(input("E: ")) | |
# Start at E so D will be bigger | |
n = E | |
while True: | |
n += 1 | |
D = (n * A + 1) / E | |
if D.is_integer() and D != E: | |
break | |
D = int(D) | |
print(f"Found D: {D}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment