sboxUv2.core.f2functions package

Dealing with basic operations over the vector space (F_2)^n (and the finite field F_(2^n).

Submodules

sboxUv2.core.f2functions.cython_functions module

class sboxUv2.core.f2functions.cython_functions.BinLinearMap

Bases: object

get_S_box()
get_input_length()
get_output_length()
inverse()
rank()
sboxUv2.core.f2functions.cython_functions.Blm(x)
sboxUv2.core.f2functions.cython_functions.from_bin(l)
sboxUv2.core.f2functions.cython_functions.hamming_weight(x)

Ultimately call a C++ intrinsic to return the Hamming weight of the vector corresponding to the binary representation of x.

Parameters:

x (-) – a positive integer

Returns:

The number of bits set to 1 in the binary representation of x.

sboxUv2.core.f2functions.cython_functions.identity_BinLinearMap(n)
sboxUv2.core.f2functions.cython_functions.linear_combination(v, mask)
sboxUv2.core.f2functions.cython_functions.lsb(x)
sboxUv2.core.f2functions.cython_functions.msb(x)
sboxUv2.core.f2functions.cython_functions.oplus(x, y)

Essentially a wrapper for the operation ^ in C++. Its purpose is to ensure that a XOR is performed regardless of the extension of the script.

Parameters:
  • x (-) – a positive integer

  • y (-) – a positive integer

Returns:

A positive integer equal to the XOR of x and y.

sboxUv2.core.f2functions.cython_functions.rank_of_vector_set(l)
sboxUv2.core.f2functions.cython_functions.scal_prod(x, y)

The canonical scalar product in F_2. Wraps a C++ function relying on specific intrinsincs.

Parameters:
  • x (-) – a positive integer

  • y (-) – a positive integer

Returns:

The scalar product x⋅y, i.e. the modulo 2 sum of the products x_i y_i, where i goes from 0 to 63.

sboxUv2.core.f2functions.cython_functions.to_bin(x, n)
sboxUv2.core.f2functions.cython_functions.xor(*args)
sboxUv2.core.f2functions.cython_functions.zero_BinLinearMap(n)

sboxUv2.core.f2functions.field_arithmetic module

sboxUv2.core.f2functions.field_arithmetic.ffe_from_int(x, gf)[source]
sboxUv2.core.f2functions.field_arithmetic.ffe_to_int(x)[source]
sboxUv2.core.f2functions.field_arithmetic.i2f_and_f2i(gf)[source]

A Helper function to deal with finite field elements and their integer representations.

Returns:

A pair of functions, namely the functions mapping field elements to integers (f2i) and the one mapping integers to field elements (i2f).

Parameters:

gf – the finite field with which we want to interact. Could have been obtained using e.g. GF(q)