hamming-distance · shipping · also Hamming metric

Hamming distance

Hamming distance counts the symbol positions in which two equal-length sequences differ.

Related Observatory article: Read on hesela.com

For a binary code, minimum distance is the smallest number of bit inversions separating any two distinct codewords; it defines a guaranteed detection bound, not an observed error rate. A code with distance HD detects every pattern of up to HD-1 inverted bits, so HD=6 rules out undetected 1- to 5-bit errors. [1]

For a fixed CRC polynomial, minimum distance can decrease as the data word grows. The IEEE 802.3 CRC-32 polynomial gives HD of at least 8 up to 91 data bits, HD=7 to 171 bits, HD=6 to 268 bits, HD=5 to 2974 bits, HD=4 to 91,607 bits and HD=3 to at least 128K bits. [3]

At a 12,112-bit data word, the size used for a maximum-length Ethernet frame, the same polynomial detects all 2- and 3-bit errors but misses 223,059 of about 906 x 10^12 possible 4-bit errors across the 12,144-bit codeword. [3]

Let n count codeword bits including the CRC, and A_w count undetectable masks with exactly w flipped positions. For 1 <= w <= n, the fraction A_w / C(n,w) applies to uniformly selected weight-w masks; it does not depend on the bit-flip probability. Overall undetected-corruption probability additionally requires an error model. [4] [3]

Relations

related
Flip-N-Write, Cyclic redundancy check, CRC-32C, CRC burst error, Error-and-erasure decoding, Interleaved parity, Stopping distance

Advantages

  • Gives a worst-case guarantee that holds for every error pattern below the distance, wherever the inverted bits fall. [1]

Limitations

  • A distance holds only for a stated data word length, so one polynomial has different distances at different message sizes. [3]
  • Full-codeword pattern counts include changes to CRC bits; a model restricted to data positions must restrict both its undetectable-mask count and its denominator. [3]

Citations

  1. Koopman and Chakravarty. CRC Polynomial Selection For Embedded Networks. DSN 2004, sections 2-4 (accessed 2026-10-22)
  2. Koopman. 32-Bit Cyclic Redundancy Codes for Internet Applications. DSN 2002, sections 1-3 (accessed 2026-10-22)
  3. Sheinwald et al. RFC 3385: iSCSI CRC/Checksum Considerations, sections 2-3 (2002) (accessed 2026-10-27)

Further reading

  1. Hesela: CRC polynomials, constructed error patterns and exact small-code enumeration (accessed 2026-10-18)
Sources & caveats
  • koopman04 is Koopman and Chakravarty, DSN 2004, read in sections 2 to 4.
  • koopman02 is Koopman, DSN 2002, read in sections 1 to 3 and Table 1.
  • The 802.3 lengths 91, 268, 2974 and 91,607 bits, 12,112 and 12,144 bits, 223,059 and 906 x 10^12 come from koopman02.
  • The fixed-weight fraction follows by conditioning RFC 3385 section 3 on exactly w flips. The DSN 2002 count includes CRC bits and is not a measured storage error rate.

JSON: /data/terms/hamming-distance.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Hamming distance. Hesela. 2026-11-29. https://hesela.dev/terms/hamming-distance/