15 return int.from_bytes(x, byteorder=
'big'), int.from_bytes(y, byteorder=
'big')
19 return '{:096x}{:096x}'.format(x,y)
21 MAX_DEGREE_POLY = FK20Py.MODULUS-1
29 return [random.randint(1, MAX_DEGREE_POLY)
for _
in range(N_POINTS)]
33 generates a test case for the fft part of the algorithm
35 setup = FK20Py.generate_setup(setup, len(polynomial))
36 _ = FK20Py.commit_to_poly(polynomial, setup)
38 fftin, fftout = FK20Py.fftTrace(polynomial, setup)
45 setup = random.getrandbits(256)
46 print(f
'setup {setup:0{256//4}x}')
48 for testN
in tqdm(range(nTest)):
50 print(
'polynomial', *[f
'{i:0{256//4}x}' for i
in poly], sep=
' ')
57 outputs.append([
pointToInt(i)
for i
in fftout])
58 return {
'polys':polys,
66 for idx, output
in enumerate(test[
'outputs']):
67 print(f
"fftTestOutput_{idx}", *[f
'{i:0{764//4}x}' for i
in output])
71 print(*args, file=sys.stderr, **kwargs)
73 if __name__ ==
'__main__':
75 print(f
"NTESTS {N_TESTS}")
77 with open(
"testfft.pickle",
'wb')
as f:
80 eprint(len(test[
'inputs'][0]))
def generateTest(list polynomial, int setup)
int pointToInt(FK20Py.blst.P1 i)
def generateAllTest(nTest=1)
def eprint(*args, **kwargs)
def printExpectedOutput(test, skip=True)
str pointToHexString(FK20Py.blst.P1 i)
str stringfyFFT_Trace(fft)