Giter Site home page Giter Site logo

cryptokid666 / luhnalgorithmproof Goto Github PK

View Code? Open in Web Editor NEW

This project forked from garwoodpr/luhnalgorithmproof

0.0 1.0 0.0 500 KB

Use Luhn Algorithm to Validate 14-16 Digit Credit Card Numbers

License: MIT License

HTML 9.19% Python 90.81%

luhnalgorithmproof's Introduction

LuhnAlgorithmProof

Python 3.4 Implementation of the Luhn Algorithm

Python3 system to validate (return True) or reject (return False) a Luhn Compliant Account Number.
Checks 14, 15, or 16 digit card numbers to determine if the number is Luhn compliant.
For details on the formula see: https://en.wikipedia.org/wiki/Luhn_algorithm

Where cardNumber is intended to be an account number (received as a string)
without white space, or separator marks:

The following numbers act as a testable demonstration
cardNumber = '111111111111119' # Luhn Valid Number
cardNumber = '111111111111111' # Invalid Luhn Number
cardNumber = '1111-111111-11119' # Luhn Valid Number but invalid format
cardNumber = '2222222222222224' # Luhn Valid Number
cardNumber = '2222222222222222' # Invalid Luhn Number
cardNumber = '2222-2222-2222-2224' # Luhn Valid Number but invalid format
cardNumber = '33333333333330' # Luhn Valid Number
cardNumber = '33333-33333-3330' # Luhn Valid Number but invalid format
cardNumber = '33333333333333' # Invalid Luhn Number

Luhn Algorithm Compliant Credit Card Types (Partial List)
see: https://en.wikipedia.org/wiki/Bank_card_number (8/2015)

Card Type, Account Digit Length
American Express, 15
Bankcard, 16
Diners Club Carte Blanche, 14
Diners Club International, 14
Diners Club United States & Canada, 16
Discover Card, 16
InstaPayment, 16
JCB, 16
Dankort, 16
MasterCard, 16
Visa, 16
UATP, 15

HART Network (c) 2015 Clint Garwood

luhnalgorithmproof's People

Contributors

garwoodpr avatar

Watchers

James Cloos 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.