🔧 Hamming Code Generator

🔄
⚙️
📝
{{ getInputExample() }} Enter complete Hamming codeword for error checking
💡
🎯
{{ result.output }}
{{ result.explanation }}
🚨
Status: {{ result.errorInfo.errorDetected ?'Error Detected' :'No Errors' }}
Error Position: {{ result.errorInfo.errorPosition }}
Syndrome: {{ result.errorInfo.syndrome }}
Action: {{ result.errorInfo.action }}
Action: {{ result.errorInfo.action }}
🔍
Step {{ step.step }}: {{ step.description }}
{{ step.calculation }}
Codeword: {{ step.codeword }}
Positions checked: {{ step.checkedPositions.join(',') }}
Status: {{ step.status }}
📊
Name: {{ result.properties.name }}
Description: {{ result.properties.description }}
Data Bits: {{ result.properties.dataBits }}
Parity Bits: {{ result.properties.parityBits }}
Total Bits: {{ result.properties.totalBits }}
Efficiency: {{ result.properties.efficiency }}
Hamming Distance: {{ result.properties.hammingDistance }}
Error Detection: {{ result.properties.errorDetection }}
Error Correction: {{ result.properties.errorCorrection }}
Characteristics:
  • {{ char }}
⚠️ {{ error }}

ℹ️ About Hamming Code Generator

Hamming codes are binary linear block codes that add calculated parity bits to a data word so a receiver can locate and repair a single flipped bit. This tool builds the classic even-parity Hamming(n,k) codes used in error-correction lessons, memory-system examples, and digital communication exercises.

Richard W. Hamming introduced the method in his 1950 Bell System Technical Journal paper Error Detecting and Error Correcting Codes. The underlying idea is based on Hamming distance, the count of bit positions that differ between two binary strings, and on binary codewords that represent protected data.

Supported Hamming codes:

  • Hamming(7,4): 4 data bits plus 3 parity bits, useful for hand-checking small examples.
  • Hamming(15,11): 11 data bits plus 4 parity bits, a larger block with the same parity-position pattern.
  • Hamming(31,26): 26 data bits plus 5 parity bits for longer binary payload examples.

How encoding works:

  • Parity bits are inserted at 1-indexed power-of-two positions: 1, 2, 4, 8, and so on.
  • Data bits fill the remaining positions unchanged, making these systematic block codes.
  • Each parity bit is calculated with XOR over the positions whose binary index includes that parity bit.
  • Example: with this tool's bit ordering, Hamming(7,4) data 1011 encodes to 0110011.

How decoding works:

  • The decoder recomputes the parity checks and combines failed checks into a syndrome value.
  • A syndrome of 0 means every parity check passed.
  • A nonzero syndrome identifies the 1-indexed bit position to flip when there is exactly one bit error.
  • Example: received codeword 0110010 has syndrome 7; flipping bit 7 recovers data 1011.

Practical uses and limits:

  • Use it to demonstrate ECC RAM concepts, channel-coding exercises, storage integrity examples, or syndrome calculations for coursework.
  • Classic Hamming codes have minimum distance 3: they can correct one bit error, or detect up to two bit errors if you are not also trying to correct the word.
  • This tool does not add the extra overall parity bit used by extended Hamming / SECDED designs, so double-bit errors are not safely correctable and may be misidentified as a single-bit error.
  • Hamming codes protect against accidental bit flips, not malicious tampering. Use checksums, hashes, or message authentication codes when you need file integrity or security checks.

API Usage Example:

POST /api/tools/conversion/hamming-code
Content-Type: application/json

{
    "mode": "encode",
    "input": "1011",
    "hammingType": "hamming-7-4"
}
Ready