curve4q.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:fourq 作者: bifurcation 项目源码 文件源码
def test_mul_windowed():
    # Test multiplication by one and two
    A = AffineToR1(Gx, Gy)
    B = MUL_windowed(1, A)
    test.testpt("mul-windowed-*1", B, A)
    A2 = DBL(A)
    B2 = MUL_windowed(2, A)
    test.testpt("mul-windowed-*2", B2, A2)

    # Test multiply over several iterations
    test_mul("mul-windowed", MUL_windowed)

    # Test fixed-based multiply
    T = table_windowed(A)
    B = MUL_windowed(1, A, table=T)
    B2 = MUL_windowed(2, A, table=T)
    test.testpt("mul-windowed-fixed-*1", B, A)
    test.testpt("mul-windowed-fixed-*2", B2, A2)

    failed = 0
    for i in range(10):
        m = getrandbits(256)
        B1 = MUL_windowed(m, A, table=T)
        B2 = MUL_windowed(m, A)
        if B1 != B2:
            failed += 1
    if failed == 0:
        print "[PASS] mul-windowed-fixed-rand"
    else:
        print "[FAIL] mul-windowed-fixed-rand"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号