checkdigit.crc.missing

checkdigit.crc.missing(data: str, polynomial: str) str[source]

Calculates missing digits represented by a question mark.

Parameters:
  • data – A string containing a question mark representing a missing digit.

  • polynomial – What the polynomial that should be used is

Returns:

The missing binary digit

Return type:

str

Examples

>>> from checkdigit import crc
>>> crc.missing("?1111111101", "1101")
'1'
>>> crc.missing("10?110010100111?0?1111?10010?011?0", "11010111101")
'011000'
>>> # If there's more than one possible option
>>> crc.missing("?1111111001", "1101")
'Invalid'