Exemple #1
0
 def createSUT():
     curve = PrimeCurves(97, 3, 2)
     point1 = AffinePoint([73, 14], curve)
     instance = ScalarMultiplication(point1, 5)
     scalar = 6
     expected_result = AffinePoint([3, 91], curve)
     return curve, instance, scalar, expected_result
Exemple #2
0
 def createSUT():
     curve = PrimeCurves(97, 3, 2)
     point1 = AffinePoint([73, 14], curve)
     point2 = AffinePoint([55, 6], curve)
     instance = JointMultiplication(point1, point2, 5, 4)
     scalar1, scalar2 = 7, 8
     expected_result = AffinePoint([28, 34], curve)
     return instance, expected_result, scalar1, scalar2
Exemple #3
0
 def test_add(self):
     curve, point1, point2 = self.createSUT()
     result = point1.add(point2)
     expected_result = AffinePoint([1, 54], curve)
     self.assertEqual(result, expected_result)
Exemple #4
0
 def createSUT():
     curve = PrimeCurves(97, 3, 2)
     point1 = AffinePoint([17, 10], curve)
     point2 = AffinePoint([95, 31], curve)
     return curve, point1, point2
Exemple #5
0
 def test_inverse(self):
     curve, point1, point2 = self.createSUT()
     result = point1.inverse()
     expected_result = AffinePoint([17, 87], curve)
     self.assertEqual(result, expected_result)
Exemple #6
0
 def test_point_double(self):
     curve, point1, point2 = self.createSUT()
     result = point1.point_double()
     expected_result = AffinePoint([32, 90], curve)
     self.assertEqual(result, expected_result)
Exemple #7
0
from DataStructures.PrimeCurves import PrimeCurves
from DataStructures.Points import AffinePoint
from FastArithmetic.scalar_multiplication import ScalarMultiplication
from FastArithmetic.joint_multiplication import JointMultiplication

curve = PrimeCurves(97, 2, 3)
P = AffinePoint([10, 16], curve)
Q = AffinePoint([14, 13], curve)

multiplier = ScalarMultiplication(P, 3)

joint_multiplier = JointMultiplication(P, Q, 4, 4)

#print(multiplier.binary_scalar_multiplication(5))
#print(multiplier.left_to_right_scalar_mul(7))
#print(multiplier.window_NAF_multiplication(39))
#print(multiplier.sliding_window_left_to_right_scalar_mul(39))

#print(joint_multiplier.brute_joint_multiplication(5, 6))
#print(joint_multiplier.JSF_Multiplication(21, 26))
#print(joint_multiplier.interleaving_sliding_window(10, 41))
print(joint_multiplier.JSF(21, 26))