GlobalFishingWatch / gpsdio

AIS I/O with Python, dictionaries, and the GPSd AIVDM schema.
Other
6 stars 3 forks source link

Ability to validate an IMO number #122

Open geowurster opened 9 years ago

geowurster commented 9 years ago

The IMO page on Wikipedia links to external resources stating that IMO numbers can be validated with a simple algorithm.

The integrity of an IMO number can be verified using its check digit. This is done by multiplying each of the first six digits by a factor of 2 to 7 corresponding to their position from right to left. The rightmost digit of this sum is the check digit. For example, for IMO 9074729: (9×7) + (0×6) + (7×5) + (4×4) + (7×3) + (2×2) = 139.