UPC/EAN checksum algorithm for product barcodes. Uses alternating weights (3,1,3,1β¦) from right to left. Used in UPC-A (12 digits), EAN-13 (13 digits), EAN-8 (8 digits) for retail product identification worldwide.
| Property | Value |
|---|---|
| Category | Checksums |
| Sub-category | Product Code |
| Security status | π Educational Only |
| Complexity | Beginner |
| Inventor | George Laurer (IBM) / GS1 |
| Year | 1973 |
| Origin | πΊπΈ United States |
| Source | algorithms/checksum/upc-ean.js |
Status: π Educational Only
No vulnerabilities are recorded for this implementation.
3 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.
Vector 1 β UPC-A validation
| Field | Value |
|---|---|
input |
3033363030303239313435 |
expected |
02 |
Vector 2 β EAN-13 validation
| Field | Value |
|---|---|
input |
343030363338313333333933 |
expected |
01 |
Vector 3 β Simple test
Source: UPC calculation
| Field | Value |
|---|---|
input |
3132333435 |
expected |
07 |