Esempio n. 1
0
def test_MultiplyByGenerator():

    # Generating Random EC
    for x in range(10):
        # using the integer value of NID secp256k1, which is 714
        nID = 714

        # Generate a Random EC Point with default NID ==> NID_secp256k1
        hexValue = Nakasendo.ECPoint(nID)
        bigNumB = Nakasendo.BigNum()
        # EC Point GetAffineCoOrdinates_GFp with default NID => NID_secp256k1
        x_axis, y_axis = hexValue.GetAffineCoOrdinates()
        assert len(x_axis) == 62 or len(x_axis) == 64, "Test failed"

        # EC Point Scalar multiply on curve with supplied ID
        actualValue = str(
            Nakasendo.MultiplyByGenerator(bigNumB, compressed=True))
        assert len(actualValue) == 66, "Test failed"
Esempio n. 2
0
    print (ECPoints)
    lgECInterpolator = Nakasendo.LGECInterpolator( ECPoints, modulo,False ) 
    print ("lgInterpolator = ", lgECInterpolator )

    xValue = 0;
    valueECPoint = lgECInterpolator( str(xValue)) 
    print ("Full LG EC Interpolation evaluation for xValue=%s is %s" % (xValue, valueECPoint.GetAffineCoOrdinates() ) )
   
    xValue = 1;
    valueECPoint = lgECInterpolator( str(xValue)) 
    print ("Full LG EC Interpolation evaluation for xValue=%s is %s" % (xValue, valueECPoint.GetAffineCoOrdinates() ) )
 
 
    print ("Hiding the BigNumber %s by multiplying it by the CurveGenerator Point %s" % ( bigNumA, GENPOINTA.GetAffineCoOrdinates()))
    
    hiddenVal = Nakasendo.MultiplyByGenerator(bigNumA)
    print(hiddenVal)
    print(len(hiddenVal.value))
    hiddenVal2 = Nakasendo.MultiplyByGenerator(bigNumA)
    print(hiddenVal)
    
    print(hiddenVal.GetAffineCoOrdinates())
    
    xValue = 1;
    value1 = lgECInterpolator( str(xValue)) 
    print ("Full LG Interpolation evaluation for xValue=%s is %s" % (xValue, value1.GetAffineCoOrdinates() ) )
    
    
    
    isDecimal = False
    if(isDecimal):