-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNIST_curves.py
64 lines (56 loc) · 3.69 KB
/
NIST_curves.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/python
from elliptic_curve import *
from finite_fields import *
class NIST:
def __init__(self, name):
self.field = FiniteField(NIST_curves[name]["p"])
self.curve = EllipticCurve(-3,int(NIST_curves[name]["b"], 16), self.field)
self.generator = EllipticCurvePoint(int(NIST_curves[name]["Gx"], 16), int(NIST_curves[name]["Gy"], 16), self.curve)
self.name = name
NIST_curves={
"P-192":{
"p" : 6277101735386680763835789423207666416083908700390324961279,
"n" : 6277101735386680763835789423176059013767194773182842284081,
"seed" : "3045ae6fc8422f64ed579528d38120eae12196d5",
"c" : "3099d2bbbfcb2538542dcd5fb078b6ef5f3d6fe2c745de65",
"b" : "64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1",
"Gx" : "188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012",
"Gy" : "07192b95ffc8da78631011ed6b24cdd573f977a11e794811"
},
"P-224":{
"p" : 26959946667150639794667015087019630673557916260026308143510066298881,
"n" : 26959946667150639794667015087019625940457807714424391721682722368061,
"seed" : "bd71344799d5c7fcdc45b59fa3b9ab8f6a948bc5",
"c" : "5b056c7e11dd68f40469ee7f3c7a7d74f7d121116506d031218291fb",
"b" : "b4050a850c04b3abf54132565044b0b7d7bfd8ba270b39432355ffb4",
"Gx" : "b70e0cbd6bb4bf7f321390b94a03c1d356c21122343280d6115c1d21",
"Gy" : "bd376388b5f723fb4c22dfe6cd4375a05a07476444d5819985007e34"
},
"P-256":{
"p" : 115792089210356248762697446949407573530086143415290314195533631308867097853951,
"n" : 115792089210356248762697446949407573529996955224135760342422259061068512044369,
"seed" : "c49d360886e704936a6678e1139d26b7819f7e90",
"c" : "7efba1662985be9403cb055c75d4f7e0ce8d84a9c5114abcaf3177680104fa0d",
"b" : "5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b",
"Gx" : "6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296",
"Gy" : "4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5",
},
"P-384":{
"p" : 39402006196394479212279040100143613805079739270465446667948293404245721771496870329047266088258938001861606973112319,
"n" : 39402006196394479212279040100143613805079739270465446667946905279627659399113263569398956308152294913554433653942643,
"seed" : "a335926aa319a27a1d00896a6773a4827acdac73",
"c" : "79d1e655f868f02fff48dcdee14151ddb80643c1406d0ca10dfe6fc52009540a495e8042ea5f744f6e184667cc722483",
"b" : "b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef",
"Gx" : "aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7",
"Gy" : "3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",
},
"P-521": {
"p" : 6864797660130609714981900799081393217269435300143305409394463459185543183397656052122559640661454554977296311391480858037121987999716643812574028291115057151,
"n" : 6864797660130609714981900799081393217269435300143305409394463459185543183397655394245057746333217197532963996371363321113864768612440380340372808892707005449,
"seed" : "d09e8800291cb85396cc6717393284aaa0da64ba",
"c" : "0b48bfa5f420a34949539d2bdfc264eeeeb077688e44fbf0ad8f6d0edb37bd6b533281000518e19f1b9ffbe0fe9ed8a3c2200b8f875e523868c70c1e5bf55bad637",
"b" : "051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00",
"Gx" : "c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66",
"Gy" : "11839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650"
}
}