-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnothing_up_my_sleeve.py
34 lines (31 loc) · 1.69 KB
/
nothing_up_my_sleeve.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Verify nothing-up-my-sleeve Bad-e parameters
exponent_PI = int(
"31415926535897932384626433832795028841971693993751058209749445"
"92307816406286208998628034825342117067982148086513282306647093"
"84460955058223172535940812848111745028410270193852110555964462"
"29489549303819644288109756659334461284756482337867831652712019"
"09145648566923460348610454326648213393607260249141273724593646"
"90828205057904964694145265114203583480543017755295093967247853"
"14473853768601703608298900695818792485036015795124469751158648"
"34232981702282978024512185647195845547038058553635079877067449"
"32000141643103568465954665107904174028590478966056256766324482"
"95783971037101323127767011065093483627404478045559895421373")
# N is the product of two 1024-bit primes
N = int(
"39269908169872415480783042290993786052464617492188822762186807"
"40384770507857761248285043531677646334977685108141602883308867"
"30576193822778965669926016060139681285512837742315138194955577"
"86861936629774555360137195824168076605945602922334789565890023"
"86432060708654325435763067908310266742009075311426592155742102"
"19181870219019805590650376833502499649775088745000720744322712"
"39798910830524344272834113148801575679297398424503041238163201"
"69252588963664576543485275388222643231464070095285873656756143"
"03577976593282594799360871751228487780301961771829747487554943"
"87948667227434687425583498529809870418645678480508315970197")
# The decryption exponent corresponding to the public exponent is 5.
import random
p = random.randrange(N)
c = pow(p, exponent_PI, N)
p2 = pow(c, 5, N)
assert p == p2
print("The nothing-up-my-sleeve parameters verify successfully.")