Changeset - d5f60adc56c0
[Not reviewed]
Merge default
0 3 0
Laman - 4 years ago 2020-12-18 12:24:54

merged caching
3 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/shamira/benchmark.py
Show inline comments
 
@@ -21,7 +21,7 @@ def measure(args):
 
def profile(args):
 
	t = TestShamira()
 

	
 
	cProfile.runctx(r"""t.test_generate_reconstruct()""", globals=globals(), locals=locals())
 
	cProfile.runctx(r"""t.test_generate_reconstruct()""", globals=globals(), locals=locals(), sort="cumtime")
 

	
 

	
 
def build_subparsers(parent):
src/shamira/fft.py
Show inline comments
 
import math
 
import cmath
 
import itertools
 
from functools import cache
 

	
 
from .gf256 import gfmul, gfpow
 

	
 
@@ -20,6 +21,7 @@ def ceil_size(n):
 
	return ni
 

	
 

	
 
@cache
 
def precompute_x(n):
 
	"""Return a geometric sequence [1, w, w**2, ..., w**(n-1)], where w**n==1.
 
	This can be done only for certain values of n."""
src/shamira/gf256.py
Show inline comments
 
@@ -29,6 +29,7 @@ L[1] = 0
 
INV = [E[255-L[i]] if i!=0 else None for i in range(256)]  # multiplicative inverse
 

	
 

	
 
@cache
 
def gfmul(a, b):
 
	"""Fast multiplication. Basic multiplication is expensive. a*b==g**(log(a)+log(b))"""
 
	assert 0<=a<=255, 0<=b<=255
 
@@ -38,6 +39,7 @@ def gfmul(a, b):
 
	return E[t]
 

	
 

	
 
@cache
 
def gfpow(x, k):
 
	"""Compute x**k."""
 
	i = 1
0 comments (0 inline, 0 general)