Hawkynt

GTIN

GTIN (Global Trade Item Number) check digit calculation per GS1 standards. Unified format for product identification supporting GTIN-8, GTIN-12 (UPC), GTIN-13 (EAN), GTIN-14. Uses alternating weights (3,1) from right to left for global supply chain compatibility.

Properties

Property Value
Category Checksums
Sub-category Product Identifier
Security status 🎓 Educational Only
Complexity Beginner
Inventor GS1 (formerly EAN/UCC)
Year 2004
Origin Not specified
Source algorithms/checksum/gtin-checksum.js

Security

Status: 🎓 Educational Only

No vulnerabilities are recorded for this implementation.

Notes

Documentation

References

Test vectors

3 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.

Vector 1 — GTIN-13 example (9780201379624)

Field Value
input 393738303230313337393632
expected 04

Vector 2 — GTIN-12 (UPC-A) example

Field Value
input 3034393633343036333835
expected 02

Vector 3 — GTIN-8 example (96385074)

Field Value
input 39363338353037
expected 04

← All algorithms