Пример #1
0
 def __init__(self, x1, y1, x2, y2, a, b, p, nist=False, bits=192):
     if nist:
         self.curve = NistPrimeCurve(bits)
     else:
         self.curve = PrimeCurves(p, b, a)
     self.point1 = JacobiPoint([x1, y1, 1], self.curve)
     self.point2 = JacobiPoint([x2, y2, 1], self.curve)
Пример #2
0
    def __init__(self,
                 x1,
                 y1,
                 x2,
                 y2,
                 a,
                 b,
                 p,
                 scalar1,
                 scalar2,
                 w1,
                 w2,
                 nist=False,
                 bits=192):
        if nist:
            self.curve = NistPrimeCurve(bits)
        else:
            self.curve = PrimeCurves(p, b, a)

        self.point1 = JacobiPoint([x1, y1, 1], self.curve)
        self.scalar1 = scalar1
        self.point2 = JacobiPoint([x2, y2, 1], self.curve)
        self.scalar2 = scalar2

        self.multiplier = FastJointMultiplier(self.point1, self.point2, w1, w2)
Пример #3
0
    def __init__(self, x, y, a, b, p, nist=False, bits=192):
        if nist:
            self.curve = NistPrimeCurve(bits)
        else:
            self.curve = PrimeCurves(p, b, a)

        self.point = JacobiPoint([x, y, 1], self.curve)
Пример #4
0
 def __init__(self, x, y, a, b, p, scalar, w, nist=False, bits=192):
     if nist:
         self.curve = NistPrimeCurve(bits)
     else:
         self.curve = PrimeCurves(p, b, a)
     self.point = JacobiPoint([x, y, 1], self.curve)
     self.scalar = scalar
     self.multiplier = FastScalarMultiplier(self.point, w)
Пример #5
0
 def __init__(self, bits):
     self.curve = NistPrimeCurve(bits)
     self.cryptogen = SystemRandom()
Пример #6
0
 def __init__(self, bits, pubKey, sig, message):
     self.curve = NistPrimeCurve(bits)
     _format = FormatMessage(message, self.curve.n)
     self.z = _format.format()
     self.pubKey = pubKey
     self.sig = sig
Пример #7
0
 def __init__(self, bits, keypair, message):
     self.curve = NistPrimeCurve(bits)
     _format = FormatMessage(message, self.curve.n)
     self.z = _format.format()
     self.prvKey = keypair[0]
     self.pubKey = keypair[1]
Пример #8
0
from FastArithmetic.scalar_multiplication import ScalarMultiplication
from FastArithmetic.joint_multiplication import JointMultiplication
from DataStructures.Points import JacobiPoint
from DataStructures.PrimeCurves import NistPrimeCurve
from util import w_NAF
from random import randint

P192 = NistPrimeCurve(192)

# generator = P192.get_generator()
# generator = generator.transform()
#
scalar1 = randint(1, P192.n - 1)
print(scalar1)
scalar2 = randint(1, P192.n - 1)
print(scalar2)
ab = scalar1 * scalar2

scalar_mul = ScalarMultiplication(P192.g, 4)
print(scalar_mul.sliding_window_left_to_right_scalar_mul(scalar1))
print(scalar_mul.sliding_window_left_to_right_scalar_mul(scalar2))
print(scalar_mul.sliding_window_left_to_right_scalar_mul(ab))

# generator_times2 = P192.g.right_to_left_scalar_mul(2)
# joint_mul = JointMultiplication(P192.g, generator_times2)
#
# print(joint_mul.brute_joint_multiplication(5000, 50001219992343243232))
# print(joint_mul.JSF_Multiplication(5000, 50001219992343243232))
# print(joint_mul.interleaving_sliding_window(5000, 50001219992343243232, 4, 5))

# P192 = NistPrimeCurve(384)