BooleanFunction {boolfun} | R Documentation |
The class BooleanFunction
implements functionality to assess cryptographic properties of Boolean functions
such as nonlinearity, algebraic immunity, resiliency, correlation immunity, ...
For a full list see the section Public Methods below.
f <- BooleanFunction( initializer )
initializer |
a vector containing 2^n integers in {0,1} or a string holding 2^n characters in {'0','1'}. |
The representations are computed in O(n2^n) using C++ code. They are computed only once, the first time they are needed/called by the user and stored in private fields. The same applies to some properties, namely algebraic immunity, algebraic degree and correlation immunity. Efforts have been made to optimize execution time rather than memory usage. For more details, see the package vignette (using the R command vignette(boolfun)
).
The returned value f
is an S3 object which is defined using the R.oo package. Methods of the returned value, say deg()
, can be accessed in two ways using f$deg()
or deg(f)
.
Heavy computations are carried only once, the first time they are needed/called. The results are stored/cached in private fields.
Private fields:
.ANF | the algebraic normal form (vector) | |
.WH | the walsh spectrum (vector) | |
.TT | the truth table (vector) | |
.deg | the algebraic degree (integer) | |
.ai | the algebraic immunity (integer) | |
.ci | the correlation immunity (integer) |
Note: R does not block access to private fields. However, using them is not recommended, use the accessors (public methods) instead.
The following representations are implemented:
tt() | returns the truth table (vector of integers) | |
wh() | returns the walsh spectrum (vector of integers) | |
anf() | returns the vector of coefficients for each of the 2^n monomials | |
ANF() | returns the algebraic normal form as an instance of Polynomial |
Some general properties:
n() | returns the number of input variables (n) | |
deg() | returns the algebraic degree |
Some properties relevant for cryptographic applications:
ai() | returns the algebraic immunity | |
nl() | returns the nonlinearity | |
ci() | returns the correlation immunity | |
res() | returns the resiliency | |
isBal() | returns true if the function has as many 0s as 1s in its truth table | |
isCi(t) | returns true if the function has correlation immunity t |
|
isRes(t) | returns true if the function has resiliency t |
BooleanFunction
inherits from Object
defined in the R.oo package. The following methods are overriden:
equals() | compares truth tables and returns true if they are the same | |
print() | displays the number of variables |
F.Lafitte
Polynomial
, R.oo:Object
, mobiusTransform
, walshTransform
truthTable <- c(0,1,1,0,1,0,0,1) f <- BooleanFunction(truthTable) g <- BooleanFunction("00100111") h <- BooleanFunction( c( tt(f), tt(g) ) ) # concatenation print( h ) # print( paste("f has (deg,ai,nl,res) = (", deg(f), ai(f), nl(f), res(f), ")" )) print( paste("g has (deg,ai,nl,res) = (", g$deg(), g$ai(), g$nl(), g$res(), ")" )) print( isBal(h) )