python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

fix checksum issue from #196

Open zspherez opened this issue 1 year ago • 1 comments

As discussed in #196, there is an issue with the generation of checksums for 13 digit EAN's.

>>> EAN13("842169142322")
evens_old 221628
evens_new 419432
evens_old_sum 21
evens_new_sum 23
odds_old 234914
odds_new 826122
odds_old_sum 23
odds_new_sum 21
old_return 4
new_return 0
<EuropeanArticleNumber13('8421691423220')>
>>> ean = EAN13("842169142322")
evens_old 221628
evens_new 419432
evens_old_sum 21
evens_new_sum 23
odds_old 234914
odds_new 826122
odds_old_sum 23
odds_new_sum 21
old_return 4
new_return 0
>>> ean.calculate_checksum()
evens_old 234914
evens_new 419432
evens_old_sum 23
evens_new_sum 23
odds_old 0221628
odds_new 826122
odds_old_sum 21
odds_new_sum 21
old_return 4
new_return 0
0

As seen in the except above, the PR here fixes this issue.

zspherez avatar Mar 27 '23 18:03 zspherez

I think that this issue was fixed in https://github.com/WhyNotHugo/python-barcode/pull/213

WhyNotHugo avatar Jun 03 '24 19:06 WhyNotHugo