conversion_hamming_code
Encode binary data into a Hamming error-correcting codeword or decode a codeword to detect and correct single-bit errors. Returns syndrome, error position, and corrected codeword.
Instructions
Hamming Code Encoder and Decoder. Encode binary data into a Hamming error-correcting codeword or decode a codeword to detect and correct a single-bit error. In encode mode it inserts parity bits at power-of-two positions; in decode mode it computes the syndrome to locate and flip one flipped bit (Hamming distance 3: corrects 1-bit errors, detects up to 2-bit errors). Use it for error-correction coding demos and parity analysis; use conversion_parity_bit for a single even/odd parity bit, or conversion_gray_code for reflected-binary encoding. Runs locally on the bit string you provide: read-only, non-destructive, offline, and rate-limited (60 requests/min anonymous). Returns the codeword or recovered data bits plus the syndrome, error position, corrected codeword, and step-by-step working.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | "encode" turns data bits into a codeword; "decode" checks a codeword and corrects a single-bit error. | |
| input | Yes | Binary string (0/1 only). For encode its length must equal the type's data bits (4/11/26); for decode it must equal the total bits (7/15/31). | |
| hammingType | No | Code size: hamming-7-4 (4 data/3 parity), hamming-15-11 (11 data/4 parity), hamming-31-26 (26 data/5 parity). | hamming-7-4 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | True when the operation succeeded. | |
| result | No | Encode and decode share input, mode, hammingType, output, steps, explanation, properties; the remaining fields depend on mode. |