How is an EAN-13 check digit calculated?
Multiply the first 12 digits alternatively by 1 (odd positions) and 3 (even positions), sum the weighted values, and take (10 - (sum mod 10)) mod 10. If the 13th digit matches this value, the barcode is structurally valid under GS1 GTIN-13 rules.