예술
뷰티 및 웰니스
공예
문화 및 역사
엔터테인먼트
환경
음식 및 음료
역공학
과학
스포츠
기술
웨어러블
Hamming Code
Mark

작성자

Mark

20. 8월 2026FI
0
0
0
0
0

Hamming Code

A parity bit tells you that something is wrong. A Hamming code tells you exactly which bit is wrong, so you can flip it back. The trick is to use several parity bits, each checking a different overlapping subset of the data, chosen so that every possible single-bit error produces a unique pattern of failed checks — and that pattern, read as a binary number, is the position of the broken bit. Richard Hamming devised it at Bell Labs around 1950 out of ordinary frustration: he ran jobs on a relay machine over the weekend, the machine detected parity errors, gave up, and dropped the job, so he came back on Monday to nothing. His question was why a machine that could detect an error could not simply fix it.
중급
1 hour

안내

1

Place the parity bits at the powers of two

Positions 1, 2, 4 and 8 are reserved; everything else carries data.

  1. Number seven positions 1 to 7.
  2. Mark positions 1, 2 and 4 as parity; 3, 5, 6 and 7 hold four data bits.
  3. Write your four data bits into their positions.
The powers of two are chosen because each has exactly one 1 in its binary representation — which is what lets each parity bit own one binary digit of the answer. The placement is doing the arithmetic.

이 단계의 재료:

Graph PaperGraph Paper1 pad
Graphite Pencil SetGraphite Pencil Set1 세트
2

Work out which bits each check covers

Each parity bit covers every position whose number contains its bit.

  1. P1 covers positions 1, 3, 5, 7 — those with a 1 in the ones place.
  2. P2 covers 2, 3, 6, 7 — a 1 in the twos place.
  3. P4 covers 4, 5, 6, 7 — a 1 in the fours place.
  4. Set each parity bit to make its own group even.
Write the position numbers in binary beside the list and the pattern is obvious. The overlapping groups are not arbitrary — they are the binary expansion of the position numbers, laid out as sets.

이 단계의 재료:

Cardstock Assorted Pack (50 Sheets)Cardstock Assorted Pack (50 Sheets)1
3

Corrupt a bit and locate it

The correction, performed by arithmetic rather than by searching.

  1. Hand your seven-bit block to someone; have them flip one bit secretly.
  2. Check each parity group and write 1 for a failed group, 0 for a passed one.
  3. Read those results as a binary number: P4 P2 P1.
  4. That number is the position of the broken bit. Flip it back.
If groups 1 and 4 fail but 2 passes, the number is 101 — position 5. Notice the parity bits check themselves too, so an error in a parity bit is located just as cleanly. All zeros means no error detected.
4

Measure the cost and find the boundary

Every code pays for its capability, and every code has a limit.

  1. Count the overhead here: 3 parity bits for 4 data bits.
  2. Work out the overhead for 11 data bits — it needs only 4 parity bits.
  3. Now flip TWO bits and run the location procedure.
Overhead falls sharply as blocks get longer, which is why real codes use large blocks. And with two errors the syndrome points confidently at a third, innocent bit — so the code makes things worse outside its region. Adding one more overall parity bit lets it DETECT two errors while still correcting one, which is the standard extended form.
5

History and context

Richard Hamming published the code in 1950, having worked it out at Bell Labs where he had access to a relay computer only at weekends. His account of the motivation is refreshingly plain: the machine could tell something had gone wrong and then simply stopped, wasting the whole run, and he thought it should be able to do better.

What it added to the parity approach: a single parity bit detects one error and locates nothing. The two-dimensional grid in the parity blueprint locates an error but costs one bit per row and per column. Hamming's overlapping groups locate it with logarithmically few bits — for 11 data bits you need 4 parity bits where a grid would need far more. Same goal, three different costs, and the right choice depends on how much overhead the channel can afford.

Where it is used: ECC memory in servers uses a Hamming-derived code to correct single-bit errors caused by cosmic rays and electrical noise, silently, millions of times a day. Hamming distance — the number of positions in which two codewords differ — became a fundamental concept in coding theory and in fields far outside it, including genetics and machine learning.

Its neighbours in the space: Reed-Solomon handles bursts of adjacent errors and is what makes a scratched CD or an obscured QR code readable; convolutional and turbo codes suit continuous noisy streams like deep-space links; a simple retransmission request is often cheaper than any of them when the channel is bidirectional and cheap. Hamming's region is where errors are isolated, retransmission is impossible or expensive, and overhead must stay small.

재료

3

관련 블루프린트

이 블루프린트들은 지식을 공유합니다 — 기술, 재료 또는 원리

CC0 퍼블릭 도메인

이 블루프린트는 CC0로 공개되었습니다. 어떤 목적으로든 자유롭게 복사, 수정, 배포 및 사용할 수 있습니다.

제품 구매를 통해 메이커를 지원하세요. 판매자가 설정한 메이커 커미션 을 받거나, 이 블루프린트의 새로운 반복을 만들어 연결로 포함시킬 수 있습니다.

토론

(0)

로그인 하여 토론에 참여하세요

댓글 로딩 중...