Selection functions API reference

exception scared.selection_functions.base.SelectionFunctionError[source]
class scared.selection_functions.base.SelectionFunction(function, words=None)[source]

Base class for selection function used by analysis framework for intermediate value computation.

This class is a callable class to validate and decorate the function provided by the user.

In most of the use cases, user should either use selection function decorators or ready-to-use selection function.

__init__(function, words=None)[source]
scared.selection_functions.base.selection_function(function=None, words=None)[source]

Decorator that wraps the provided function as a selection function.

Parameters:
  • function (callable) – the attack selection function callable.

  • words (ndarray, slice, list, default=None) – words subselection used by the selection function.

scared.selection_functions.base.attack_selection_function(function=None, guesses=range(0, 256), words=None, expected_key_function=None)[source]

Decorator that wraps provided selection function as an attack selection function.

Attack selection function must accepts a guesses parameter.

Parameters:
  • function (callable) – the attack selection function callable.

  • guesses (ndarray or range, default=range(256)) – guesses values to be used by the selection function.

  • words (ndarray, slice, list, default=None) – words subselection used by the selection function.

  • expected_key_function (callable, default=None) – callable to compute the corresponding expected key value for this selection function.

scared.selection_functions.base.compute_expected_key()

returns the result of expected_key_function, if available.

scared.selection_functions.base.reverse_selection_function(function=None, words=None)[source]

Decorator that wraps provided selection function as a reverse selection function.

Parameters:
  • function (callable) – the attack selection function callable.

  • words (ndarray, slice, list, default=None) – words subselection used by the selection function.