Hamming
An ANSI C implementation of Hamming codes
Install / Use
/learn @MichaelDipperstein/HammingREADME
DESCRIPTION
This archive contains an ANSI C library of functions implementing [7, 4] Hamming encode and decode operations. These implementations attempt to strike a reasonable comprise between readability, adaptability speed, and memory usage.
There are two implementations for Hamming encoding, one that uses matrix multiplication and one that uses a lookup table. The lookup table version is smaller and faster, but I used the matrix version to come up with the table for the table version.
There are three implementations for Hamming decoding, one that uses matrix multiplication, one that uses a lookup table and one that uses a packed lookup table. The packed table version is smaller, but slower than the table version, and both versions are smaller and faster than the matrix version, but I used the matrix version to come up with the tables for the table versions.
More information on Hamming encoding and decoding may be found at: https://michaeldipperstein.github.io/hamming.html
FILES
COPYING - Rules for copying and distributing GPL software COPYING.LESSER - Rules for copying and distributing LGPL software hamming.c - Hamming encode and decode functions hamming.h - Prototypes for encode and decode functions LICENSE - GNU Lesser General Public License (LGPL) Makefile - makefile for this project (assumes gcc compiler and GNU make) README - this file testall.c - Source for verifying routines and generating encode and decode lookup tables.
BUILDING
To build these files with GNU make and gcc:
- Windows users should define the environment variable OS to be Windows or Windows_NT. This is often already done.
- Enter the command "make" from the command line.
USAGE
Usage: testall <options>
options: D : Generate decode tables E : Generate encode table
Default usages with no options tests all functions.
HISTORY
12/29/04 - Initial release 10/24/05 - Corrected errors in decode matrices pointed out by Ivan Piasini furettoo@gmail.com - Added test that verifies all single bit errors are correctly decoded. 08/29/07 - Licensed explicitly under LGPL version 3.
TODO
- Add code to build code (C) and parity check (H) matrices from a definition of parity bits.
- Generalize for schemes other than (7, 4).
AUTHOR
Michael Dipperstein (mdipperstein@gmail.com) https://michaeldipperstein.github.io
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
