hamming-code

0.0.2 • Public • Published

hamming-code

Hamming-code allows you to encode and decode binary strings with hamming linear error correcting codes algorithm. It has not any dependencies. Works only with binary strings. For example '101010'.

It is UMD module. It means it capable of working in AMD, CommonJS-like, nodejs, browrser environments. For more information go to UMD.

npm install hamming-code

Example

var hammingCode = require("./index.js");
 
console.log("Encode 1111: ", hammingCode.encode("1111"));
console.log("Decode 0011111: ", hammingCode.decode(hammingCode.encode("1111")));
console.log("Check 0011111: ", hammingCode.check(hammingCode.encode("1111")));
console.log("Check 0001111: ", hammingCode.check("0001111"));
console.log("Decode 0001111: ", hammingCode.decode("0001111"));
console.log("Pure Decode (without correcting) 0001111: ", hammingCode.pureDecode("0001111"));

Dependents (2)

Package Sidebar

Install

npm i hamming-code

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • georgelviv