jvdsn / crypto-attacks

Python implementations of cryptographic attacks and utilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

shared.ecc.generate_with_order speed up

uvicorn opened this issue · comments

same problem: J08nY/ecgen#23
pari.qfbsolve(pari.Qfb(1, 0, -D), 4 * m, 1) is slow because pari try to factor m every time.
our solution:

m = Integer(sys.argv[1])
out = subprocess.check_output(['./yafu'], input=f'factor({m})'.encode())
for p in [int(a.split(b' = ')[1]) for a in out.splitlines() if b' = ' in a and a[0] == b'P'[0]]:
    if p > 1000:
        pari.addprimes(p)

seems we can replace yafu with default sage factor(m)

Does a23ab9a address your concerns?

Yes, thanks! Btw for me almost always worked D=[16,64,256] and idk why