Navigation

  • index
  • modules |
  • next |
  • previous |
  • CLAASP: Cryptographic Library for Automated Analysis of Symmetric Primitives v3.1.0 documentation »
  • Generate sbox inequalities for trail search

Generate sbox inequalities for trail search¶

Part of this code has been extracted from an external source available at : https://gist.github.com/pfasante/3a2f087e74cd0f2a10853c8a5d036d85 Generate inequalities for 8-bit sboxes is infeasible with this module. The module generate_inequalities_for_large_sboxes.py take care of both cases, small and large sboxes. Hence, this module can be removed, but we decide to keep it for comparison purpose.

convex_hull(sbox, analysis='differential', big_endian=False)¶

Compute the convex hull of the differential or linear behaviour of the given S-box.

INPUT:

  • sbox – SBox object; the S-box for which the convex hull should be computed

  • analysis – string (default: differential); choosing between differential and linear behaviour

  • big_endian – boolean (default: False); representation of transitions vectors

cutting_off_greedy(dict_polyhedron)¶

Compute a set of inequalities that is cutting-off equivalent to the H-representation of the given convex hull.

INPUT:

  • dict_polyhedron – dictionary; the polyhedron representing the convex hull

cutting_off_milp(dict_polyhedron, number_of_ineqs=None)¶

Compute a set of inequalities that is cutting-off equivalent to the H-representation of the given convex hull by solving a MILP.

The representation can either be computed from the minimal number of necessary inequalities, or by a given number of inequalities. This second variant might be faster, because the MILP solver that later uses this representation can do some optimizations itself.

INPUT:

  • dict_polyhedron – dictionary; the polyhedron representing the convex hull

  • number_of_ineqs – integer (default: None); either None or the number of inequalities that should be used for representing the S-box.

delete_dictionary_that_contains_inequalities_for_small_sboxes(analysis='differential')¶
get_dictionary_that_contains_inequalities_for_small_sboxes(analysis='differential')¶

Compute a set of inequalities that is cutting-off equivalent to the H-representation of the given convex hull.

INPUT:

  • analysis - string (default: differential);

sbox_inequalities(sbox, analysis='differential', algorithm='milp', big_endian=False)¶

Compute inequalities for modeling the given S-box.

INPUT:

  • sbox – SBox object; the S-box to model

  • analysis – string (default: differential); choosing between ‘differential’ and ‘linear’ cryptanalysis

  • algorithm – string (default: greedy); choosing the algorithm for computing the S-box model, one of [‘none’, ‘greedy’, ‘milp’]

  • big_endian – boolean (default: False); representation of transitions vectors

    EXAMPLES:

    sage: from sage.crypto.sbox import SBox sage: SBox_PRESENT = SBox([12,5,6,11,9,0,10,13,3,14,15,8,4,7,1,2]) sage: from claasp.cipher_modules.models.milp.utils.generate_sbox_inequalities_for_trail_search import * sage: sbox_ineqs = sbox_inequalities(SBox_PRESENT) # long sage: sbox_ineqs[2][1] An inequality (0, 0, 0, 1, 1, 0, 1, 0) x - 1 >= 0

to_bits(n, x, big_endian=False)¶
update_dictionary_that_contains_inequalities_for_small_sboxes(sbox, analysis='differential')¶

Previous topic

Dictionary that contains inequalities for small sboxes

Next topic

Dictionary containing truncated xor inequalities between n input bits

This Page

  • Show Source

Quick search

Navigation

  • index
  • modules |
  • next |
  • previous |
  • CLAASP: Cryptographic Library for Automated Analysis of Symmetric Primitives v3.1.0 documentation »
  • Generate sbox inequalities for trail search
© Copyright 2005--2022, The Sage Development Team.