algorand_mnemonic_utils

Module for Algorand mnemonic utility classes.

class AlgorandMnemonicUtils

Bases: object

Class container for Algorand mnemonic utility functions.

static ComputeChecksum(data_bytes: bytes) bytes

Compute checksum.

Parameters:

data_bytes (bytes) – Data bytes

Returns:

Computed checksum

Return type:

bytes

static ComputeChecksumWordIndex(data_bytes: bytes) int

Compute checksum word index.

Parameters:

data_bytes (bytes) – Data bytes

Returns:

Computed checksum word index

Return type:

str

static ConvertBits(data: Union[bytes, List[int]], from_bits: int, to_bits: int) Optional[List[int]]

Perform bit conversion. The function takes the input data (list of integers or byte sequence) and convert every value from the specified number of bits to the specified one. It returns a list of integer where every number is less than 2^to_bits.

Parameters:
  • data (list[int] or bytes) – Data to be converted

  • from_bits (int) – Number of bits to start from

  • to_bits (int) – Number of bits to end with

Returns:

List of converted values, None in case of errors

Return type:

list[int]