Giter VIP home page Giter VIP logo

algorithm-damm's Introduction

NAME
    Algorithm::Damm - Calculate the Damm error correction check digit.

SYNOPSIS
      use Algorithm::Damm qw/check_digit is_valid/;

      $c = check_digit("43881234567");
      print "It works\n" if is_valid("43881234567$c");

DESCRIPTION
    This module implements the Damm algorithm for calculating a check digit.

    You can find information about the algorithm by searching the web for
    "Damm ECC". In particular, see the "SEE ALSO" section (below).

FUNCTIONS
    is_valid CHECKSUMMED_NUM
        This function returns 1 if the final character of CHECKSUMMED_NUM is
        the correct checksum for the rest of the number, 0 if not, and undef
        if CHECKSUMMED_NUM contains an invalid character or does not contain
        at least two digits (one for the number, and one for the checksum).

        This function is equivalent to

          substr $N,length($N)-1 eq check_digit(substr $N,0,length($N)-1)

        Additionally, due to the way this algorithm works, if you crank the
        checksum calculation through the last digit (checkdigit included),
        you will end up with a value of 0.

    check_digit NUM
        This function returns the checksum of the given number. It will
        return undef if it is not able to calculate the checksum.

HISTORY
    This module came about as I was reverse engineering a checksum method
    being used on another project of mine. History of the method used was
    lost to the sands of time, and I needed something to run some quick
    tests on various checksum algorithms.

    This module is a reimplementation of one of the algorithms I had tested.

SEE ALSO
    Algorithm::CheckDigits
        Algorithm::CheckDigits is a module that this probably should have
        been written as a part of. There is an open issue
        (<MidLifeXis/perl-algorithm-damm#1>) to
        add an integration layer for this module to Algorithm::CheckDigits.

    Algorithm::LUHN
        Original code based on Algorithm::LUHN by Tim Ayers.

    Math::CheckDigits
        Slightly different approach to generating check digits.

    Wikipedia
        <http://en.wikipedia.org/wiki/Damm_algorithm> - Article explaining
        the Damm error correction algorithm.

REPOSITORY
    You can find the source at
    <https://www.github.org/MidLifeXis/perl-algorithm-damm>.

BUGS
    None known at this time, but feel free to submit them to RT or the issue
    tracker for this source at GitHub.

AUTHOR
    This module was written by Brian T. Wightman
    (http://search.cpan.org/search?author=MLX) based on the module
    Algorithm::LUHN by Tim Ayers.

COPYRIGHT
    Copyright (c) 2013 Brian T. Wightman. All rights reserved.

LICENSE
    This program is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

algorithm-damm's People

Contributors

midlifexis avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.