A length-\(n\) binary code whose codewords all have Hamming weight two. Such codes provide slightly extra redundancy for storage of small-scale information such as ZIP codes or decimal digits.
For example, the two-in-five code has a size 10, thereby providing an encoding for the decimal digits 0 through 9. Such a code detects some single bit-flips as well as unidirectional errors using the fact that each codeword is weight-two. The code fails for any sequence of flips that maintains the constant weight.
Two-in-five, also known as the two-out-of-five code, was used in the United States Postal Service's POSTNET barcode system as well as the Postal Alpha-numeric Encoding Technique (PLANET).Two-in-five code forms the numerical part of the Code 39 barcode encoding.Two-in-five code was used on early IBM computers .
See Ch. 19 of book  on weight-two codes.
- R. W. Hamming, Letter, April 5, 1978.
- J. Svigals, “IBM 7070 data processing system”, Papers presented at the the March 3-5, 1959, western joint computer conference on XX - IRE-AIEE-ACM ’59 (Western) (1959) DOI
- T. M. Thompson, From Error-Correcting Codes Through Sphere Packings To Simple Groups, Mathematical Association of America, 1983.
- W. C. Huffman, J.-L. Kim, and P. Solé, Concise Encyclopedia of Coding Theory (Chapman and Hall/CRC, 2021) DOI
Page edit log
- Victor V. Albert (2022-08-12) — most recent
“Weight-two code”, The Error Correction Zoo (V. V. Albert & P. Faist, eds.), 2022. https://errorcorrectionzoo.org/c/weight_two