galois-field

Interpolate polynomial over a finite field

十年热恋 提交于 2019-12-22 09:00:57
问题 I want to use python interpolate polynomial on points from a finite-field and get a polynomial with coefficients in that field. Currently I'm trying to use SymPy and specifically interpolate (from sympy.polys.polyfuncs ), but I don't know how to force the interpolation to happen in a specific gf. If not, can this be done with another module? Edit: I'm interested in a Python implementation/library. 回答1: SymPy's interpolating_poly does not support polynomials over finite fields. But there are

How to calculate numpy arrays on galois field?

杀马特。学长 韩版系。学妹 提交于 2019-12-21 17:14:10
问题 I want to use numpy array on galois field (GF4). so, I set GF4 class to array elements. It works on array + integer calculation but it dosen't works on array + array calculation. import numpy class GF4(object): """class for galois field""" def __init__(self, number): self.number = number self.__addL__ = ((0,1,2,3),(1,0,3,2),(2,3,0,1),(3,2,1,0)) self.__mulL__ = ((0,0,0,0),(0,1,2,3),(0,2,3,1),(0,3,1,2)) def __add__(self, x): return self.__addL__[self.number][x] def __mul__(self, x): return self

Shifting indexes similar to fftshift in Matlab for own range

寵の児 提交于 2019-12-13 04:32:52
问题 In this discussion, the result of fft is indices (0:N-1). fftshift simply converts that to [(N/2:N-1) (0:(N/2-1))]. I want to convert original range (O:N-1) to (t/N: t/N + 1), where t is time and assume integer and divisibel by N . I am using the Galois vectors as my datatype. Is this possible with built-in functions in Matlab? How can you achieve it in Matlab? 回答1: In general, given a data vector, if you want to shift the range from 0:N-1 to [a:N-1 0:a-1] for some a (0<=a<=N), you can do it

How to find the row rank of matrix in Galois fields?

℡╲_俬逩灬. 提交于 2019-12-11 03:07:34
问题 Matlab has a built-in function for calculating rank of a matrix with decimal numbers as well as finite field numbers. However if I am not wrong they calculate only the lowest rank (least of row rank and column rank). I would like to calculate only the row rank, i.e. find the number of independent rows of a matrix (finite field in my case). Is there a function or way to do this? 回答1: In linear algebra the column rank and the row rank are always equal (see proof), so just use rank (if you're

Fast Exponentiation for galois fields

房东的猫 提交于 2019-12-10 08:09:02
问题 I want to be able to compute g^x = g * g * g * ... * g (x times) where g is in a finite field GF(2^m). Here m is rather large, m = 256, 384, 512, etc. so lookup tables are not the solution. I know that there are really fast algorithms for a similar idea, modpow for Z/nZ (see page 619-620 of HAC). What is a fast, non-table based way to compute cycles (i.e. g^x)? This is definitely a wishful question but here it comes: Can the idea of montgomery multiplication/exponentiation be 'recycled' to

Fast Exponentiation for galois fields

假如想象 提交于 2019-12-05 18:17:03
I want to be able to compute g^x = g * g * g * ... * g (x times) where g is in a finite field GF(2^m). Here m is rather large, m = 256, 384, 512, etc. so lookup tables are not the solution. I know that there are really fast algorithms for a similar idea, modpow for Z/nZ (see page 619-620 of HAC ). What is a fast, non-table based way to compute cycles (i.e. g^x)? This is definitely a wishful question but here it comes: Can the idea of montgomery multiplication/exponentiation be 'recycled' to Galois fields? I would like to think so because of the isomorphic properties but I really don't know.

How to calculate numpy arrays on galois field?

╄→尐↘猪︶ㄣ 提交于 2019-12-04 07:25:16
I want to use numpy array on galois field (GF4). so, I set GF4 class to array elements. It works on array + integer calculation but it dosen't works on array + array calculation. import numpy class GF4(object): """class for galois field""" def __init__(self, number): self.number = number self.__addL__ = ((0,1,2,3),(1,0,3,2),(2,3,0,1),(3,2,1,0)) self.__mulL__ = ((0,0,0,0),(0,1,2,3),(0,2,3,1),(0,3,1,2)) def __add__(self, x): return self.__addL__[self.number][x] def __mul__(self, x): return self.__mulL__[self.number][x] def __sub__(self, x): return self.__addL__[self.number][x] def __div__(self,

How do I compute logarithms in cryptography?

和自甴很熟 提交于 2019-12-04 05:58:28
问题 I am trying to perform non-linear functions on bytes to implement SAFER+. The algorithm requires computing base-45 logarithm on bytes, and I don't understand how to do it. log 45 (201) = 1.39316393 When I assign this to a byte, the value is truncated to 1, and I can't recover the exact result. How am I supposed to handle this? 回答1: Cryptography often uses prime fields, in this case, GF(257). Create an exponentiation table that looks like this: exp | log ----+---- 0 | 1 1 | 45 2 | 226 3 | 147

How to perform inverse in GF(2) and multiply in GF(256) in Matlab?

Deadly 提交于 2019-12-02 07:58:54
问题 I have a binary matrix A (only 1 and 0 ), and a vector D in Galois field (256). The vector C is calculated as: C = (A^^-1)*D where A^^-1 denotes the inverse matrix of matrix A in GF(2) , * is multiply operation. The result vector C must be in GF(256) . I tried to do it in Matlab. A= [ 1 0 0 1 1 0 0 0 0 0 0 0 0 0; 1 1 0 0 0 1 0 0 0 0 0 0 0 0; 1 1 1 0 0 0 1 0 0 0 0 0 0 0; 0 1 1 1 0 0 0 1 0 0 0 0 0 0; 0 0 1 1 0 0 0 0 1 0 0 0 0 0; 1 1 0 1 1 0 0 1 0 1 0 0 0 0; 1 0 1 1 0 1 0 0 1 0 1 0 0 0; 1 1 1 0

How to perform inverse in GF(2) and multiply in GF(256) in Matlab?

喜夏-厌秋 提交于 2019-12-02 02:55:01
I have a binary matrix A (only 1 and 0 ), and a vector D in Galois field (256). The vector C is calculated as: C = (A^^-1)*D where A^^-1 denotes the inverse matrix of matrix A in GF(2) , * is multiply operation. The result vector C must be in GF(256) . I tried to do it in Matlab. A= [ 1 0 0 1 1 0 0 0 0 0 0 0 0 0; 1 1 0 0 0 1 0 0 0 0 0 0 0 0; 1 1 1 0 0 0 1 0 0 0 0 0 0 0; 0 1 1 1 0 0 0 1 0 0 0 0 0 0; 0 0 1 1 0 0 0 0 1 0 0 0 0 0; 1 1 0 1 1 0 0 1 0 1 0 0 0 0; 1 0 1 1 0 1 0 0 1 0 1 0 0 0; 1 1 1 0 0 0 1 1 1 0 0 1 0 0; 0 1 1 1 1 1 1 0 0 0 0 0 1 0; 0 0 0 0 1 1 1 1 1 0 0 0 0 1; 0 1 1 1 1 0 1 1 1 0 1 1