sboxU.core.building_blocks package

Submodules

sboxU.core.building_blocks.butterflies module

sboxU.core.building_blocks.butterflies.closed_butterfly(alpha, beta)[source]

Returns the closed butterfly S-box defined by the parameters alpha and beta.

The closed butterfly is the vectorial Boolean function (x, y) -> (f(x,y), f(y,x)) where f(x, y) = (x + alpha*y)^3 + beta*y^3, operating on pairs of elements from the same finite field of characteristic 2.

It was introduced in [C:PerUdoBir16], and then refined in [IEEE:CanDuvPer17] (where conditions on alpha and beta for APN-ness were identified).

Parameters:
  • alpha – A finite field element.

  • beta – A finite field element belonging to the same field as alpha.

Returns:

An S_box instance whose LUT encodes the closed butterfly.

Raises:

Exception – If alpha and beta do not belong to the same field.

sboxU.core.building_blocks.butterflies.open_butterfly(alpha, beta)[source]

Returns the open butterfly S-box defined by the parameters alpha and beta.

The open butterfly is the vectorial Boolean function (x, y) -> (f(y, g(x,y)), g(x,y)) where f(x, y) = (x + alpha*y)^3 + beta*y^3 and g(x, y) = (beta*y^3 + x)^{1/3} + alpha*y, operating on pairs of elements from the same finite field of characteristic 2 with odd degree.

It was introduced in [C:PerUdoBir16], and then refined in [IEEE:CanDuvPer17] (where conditions on alpha and beta for APN-ness were identified).

Parameters:
  • alpha – A finite field element.

  • beta – A finite field element belonging to the same field as alpha.

Returns:

An S_box instance whose LUT encodes the open butterfly.

Raises:

Exception – If alpha and beta do not belong to the same field.

sboxU.core.building_blocks.cython_functions module

class sboxU.core.building_blocks.cython_functions.InsecurePRNG

Bases: object

sboxU.core.building_blocks.cython_functions.rand_S_box()
sboxU.core.building_blocks.cython_functions.rand_invertible_S_box()

sboxU.core.building_blocks.one_round_functions module

sboxU.core.building_blocks.one_round_functions.feistel_round(F1)[source]
Parameters:

F1 – an S_box-able object.

Returns:

An S_box which is the result of a classic feistel round with round function F1

sboxU.core.building_blocks.one_round_functions.swap_halves(n)[source]
Parameters:

n – The bit length of the result.

Returns:

A n-bit S_box which swaps the most significant half of the input and the least significant one.