Skip to content

Commit

Permalink
chore: Fix checksum algo for estonia
Browse files Browse the repository at this point in the history
  • Loading branch information
mdomke committed May 9, 2024
1 parent 24f4b2c commit 6c1188e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion schwifty/checksum/estonia.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ class DefaultAlgorithm(checksum.Algorithm):

def compute(self, components: list[str]) -> str:
weights = cycle([7, 3, 1])
return str(10 - checksum.weighted(reversed("".join(components)), 10, weights))
digit = checksum.weighted(reversed("".join(components)), 10, weights)
digit = digit if digit == 0 else 10 - digit
return str(digit)

0 comments on commit 6c1188e

Please sign in to comment.