Nitrogen Poisonous Monoxide
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    hudsonpublic

    Hudson

    Usage

    To use hudson, initialise it with a require statement at the top of your file var hudson = require('hudson');

    Then to correct a code, call hudson.correct(code, key) where code is a string of the hamming code you want corrected and key is the string of the correction key (formatted abcdxyz - see below for details).

    The above will then return an Object of the following layout:

    {
        encoded: 0101001,
        decoded: 0111,
        correctionMade: true
    }
    

    Key

    The key you provide to hudson tells it how to generate the correction matrix for your hamming code.

    EXAMPLE

    a corresponds to the vector [0,0,1], b to [0,1,0] and so on.

    If I provide the key axbyczd, the following correction matrix is generated:

    [[0,0,1],[1,0,1],[0,1,0],[1,1,0],[0,1,1],[1,1,1],[1,0,0]]
    

    After you give your key, the decoded data will be sent back in the decoded element of the result. This decoded data will be the a, b, c, and d components of your input data.
    The encoded element of the result corresponds to the corrected data with the check digits (x, y and z) left in.

    License

    Copyright (C) William Archinal 2013

    Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

    Keywords

    none

    install

    npm i hudson

    Downloadsweekly downloads

    6

    version

    0.0.0

    license

    none

    last publish

    collaborators

    • avatar