Hawkynt

UPC-EAN

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.

Properties

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

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 β€” 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

← All algorithms