secure_comparison.utils module

Functions that don’t belong to one of the players

secure_comparison.utils.from_bits(bits)[source]

Convert a set of bits, least significant bit first to an integer.

Parameters:

bits (List[int]) – List of bits, least significant bit first.

Return type:

int

Returns:

Integer representation of the bits.

secure_comparison.utils.to_bits(integer, bit_length)[source]

Convert a given integer to a list of bits, with the least significant bit first, and the most significant bit last.

Parameters:
  • integer (int) – Integer to be converted to bits.

  • bit_length (int) – Amount of bits to which the integer should be converted.

Return type:

List[int]

Returns:

Bit representation of the integer in bit_length bits. Least significant bit first, most significant last.