mirror of
https://github.com/restic/restic.git
synced 2025-08-15 08:47:30 +00:00
chunker: Require a random irreducible polynomial
This also implements the necessary polynomial arithmetics in F_2[X].
This commit is contained in:
25
doc/test_irreducibility.gap
Normal file
25
doc/test_irreducibility.gap
Normal file
@@ -0,0 +1,25 @@
|
||||
# This file is a script for GAP and tests a list of polynomials in hexadecimal
|
||||
# for irreducibility over F_2
|
||||
|
||||
# create x over F_2 = GF(2)
|
||||
x := Indeterminate(GF(2), "x");
|
||||
|
||||
# test if polynomial is irreducible, i.e. the number of factors is one
|
||||
IrredPoly := function (poly)
|
||||
return (Length(Factors(poly)) = 1);
|
||||
end;;
|
||||
|
||||
# create a polynomial in x from the hexadecimal representation of the
|
||||
# coefficients
|
||||
Hex2Poly := function (s)
|
||||
return ValuePol(CoefficientsQadic(IntHexString(s), 2), x);
|
||||
end;;
|
||||
|
||||
# list of candidates, in hex
|
||||
candidates := [ "3DA3358B4DC173" ];
|
||||
|
||||
# create real polynomials
|
||||
L := List(candidates, Hex2Poly);
|
||||
|
||||
# filter and display the list of irreducible polynomials contained in L
|
||||
Display(Filtered(L, x -> (IrredPoly(x))));
|
Reference in New Issue
Block a user