latest.ipv8.attestation.wallet.primitives.cryptography_wrapper

Module Contents

Functions

generate_safe_prime() → int)

Generate a 'safe' prime p ((p-1)/2 is also prime).

is_prime() → bool)

Check a number for primality.

latest.ipv8.attestation.wallet.primitives.cryptography_wrapper.generate_safe_prime(bit_length: int, backend: cryptography.hazmat.backends.openssl.backend.Backend = default_backend()) int

Generate a ‘safe’ prime p ((p-1)/2 is also prime).

Parameters:
  • bit_length (int) – the length of the generated prime in bits

  • backend (Backend) – the cryptography backend to use

Returns:

the generated prime

Return type:

int

latest.ipv8.attestation.wallet.primitives.cryptography_wrapper.is_prime(number: int, backend: cryptography.hazmat.backends.openssl.backend.Backend = default_backend()) bool

Check a number for primality.

Parameters:
  • number (int) – the number to check for primality

  • backend (Backend) – the cryptography backend to use

Returns:

True is the n is expected to be prime, False otherwise

Return type:

bool