SkillAgentSearch skills...

Hamming

An ANSI C implementation of Hamming codes

Install / Use

/learn @MichaelDipperstein/Hamming
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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:

  1. Windows users should define the environment variable OS to be Windows or Windows_NT. This is often already done.
  2. 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

View on GitHub
GitHub Stars15
CategoryDevelopment
Updated1mo ago
Forks0

Languages

C

Security Score

90/100

Audited on Feb 13, 2026

No findings