stdnum.hr.oib

OIB (Osobni identifikacijski broj, Croatian identification number).

The personal identification number is used to identify persons and legal entities in Croatia. It has 11 digits (sometimes prefixed by HR), contains no personal information and uses the ISO 7064 Mod 11, 10 checksum algorithm.

>>> validate('HR 33392005961')
'33392005961'
>>> validate('33392005962')  # invalid check digit
Traceback (most recent call last):
    ...
InvalidChecksum: ...
stdnum.hr.oib.compact(number)

Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.hr.oib.is_valid(number)

Check if the number is a valid OIB number.

stdnum.hr.oib.validate(number)

Check if the number is a valid OIB number. This checks the length, formatting and check digit.