Commit 1b3ecd48 authored by Nathan/Eilisha Shiraini's avatar Nathan/Eilisha Shiraini
Browse files

Added the ability to retrieve a Gallois Field from a number of columns

parent 623c731c
......@@ -11,6 +11,7 @@ MODE_MESSAGE = -1
cdef class _GF(object):
cdef uint16_t* __exptable
cdef uint16_t* __logtable
cdef public uint16_t polynomial
def __cinit__(self, wordsize, minlayers, maxlayers, polynomial):
self.__exptable = <uint16_t*>malloc(sizeof(uint16_t) * (1 << (wordsize + 1)))
......@@ -150,4 +151,13 @@ class GalloisField(Enum):
GF64 = _GF(6, 1, 2, 0x43)
GF256 = _GF(8, 3, 8, 0x12D)
GF1024 = _GF(10, 9, 22, 0x409)
GF4096 = _GF(12, 23, 32, 0x1096)
\ No newline at end of file
GF4096 = _GF(12, 23, 32, 0x1096)
@classmethod
def getFieldForLayers(cls, layers):
if layers <= 0:
return cls.GF16
for f in cls:
if layers >= f.minlayers and layers <= f.maxlayers:
return f
return None
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment