pyctr.crypto.seeddb module

exception pyctr.crypto.seeddb.SeedDBError[source]

Bases: PyCTRError

Generic exception for seed operations.

exception pyctr.crypto.seeddb.InvalidProgramIDError[source]

Bases: SeedDBError

Program ID is not in a valid format.

exception pyctr.crypto.seeddb.InvalidSeedError[source]

Bases: SeedDBError

The provided seed is not in a valid format.

exception pyctr.crypto.seeddb.MissingSeedError[source]

Bases: SeedDBError

Seed not found in the database.

pyctr.crypto.seeddb.load_seeddb(fp=None)[source]

Load a seeddb file.

Parameters:

fp (FilePathOrObject) – A file path or file-like object with the seeddb data.

pyctr.crypto.seeddb.get_seed(program_id, *, load_if_required=True)[source]

Get a seed for a Program ID.

Parameters:
  • program_id (Union[int, str, bytes]) – The Program ID to search for. If bytes is provided, the value must be little-endian.

  • load_if_required (bool) – Automatically load using load_seeddb() if the requested Program ID is not already available.

pyctr.crypto.seeddb.add_seed(program_id, seed)[source]

Adds a seed to the database.

Parameters:
  • program_id (Union[int, str, bytes]) – The Program ID associated with the seed. If bytes is provided, the value must be little-endian.

  • seed (Union[bytes, str]) – The seed to add.

pyctr.crypto.seeddb.get_all_seeds()[source]

Gets all the loaded seeds.

Returns:

A read-only view of the seed database.

pyctr.crypto.seeddb.save_seeddb(fp)[source]

Save the seed database to a seeddb file.

Parameters:

fp (FilePathOrObject) – A file path or file-like object to write the seeddb data to.