Skip to content

BasicRegister

Base class which implements the parts shared by all registers, such as initialization and the handling of the final XOR value. It leaves the actual per byte update to its subclasses, Register and TableBasedRegister.

Bases: AbstractRegister

Implements the common crc algorithm, assuming a user of this base class will provide an overwrite for the _process_byte method.

__getitem__(index)

Gets a single byte of the register.

Parameters:

Name Type Description Default
index int

byte which shall be returned.

required

Returns:

Type Description
int

The byte at the specified index.

Raises:

Type Description
IndexError

Invalid index for this register.

__init__(configuration)

Create a new BasicRegister.

Parameters:

Name Type Description Default
configuration Configuration

Used to configure the crc algorithm.

required

__len__()

Returns:

Type Description
int

The width of the register.

digest()

See AbstractRegister.digest

init()

See AbstractRegister.init

reverse()

See AbstractRegister.digest

update(data)

See AbstractRegister.update