Changeset - 0c78bfbee218
[Not reviewed]
default
0 2 1
Laman - 3 years ago 2022-03-03 22:36:36

compatibility with python<3.9
3 files changed with 11 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/shamira/fft.py
Show inline comments
 
@@ -3,8 +3,8 @@
 
import math
 
import cmath
 
import itertools
 
from functools import cache
 

	
 
from .util import cache
 
from .gf256 import gfmul, gfpow
 

	
 
# divisors of 255 and their factors in natural numbers
src/shamira/gf256.py
Show inline comments
 
@@ -2,9 +2,11 @@
 

	
 
"""Arithmetic operations on Galois Field 2**8. See https://en.wikipedia.org/wiki/Finite_field_arithmetic"""
 

	
 
from functools import reduce, cache
 
from functools import reduce
 
import operator
 

	
 
from .util import cache
 

	
 

	
 
def _gfmul(a, b):
 
	"""Basic multiplication. Russian peasant algorithm."""
src/shamira/util.py
Show inline comments
 
new file 100644
 
try:
 
	from functools import cache
 
except ImportError:  # Python<3.9
 
	from functools import lru_cache
 

	
 
	def cache(f):
 
		return lru_cache(maxsize=None)(f)
0 comments (0 inline, 0 general)