Skip to main content

An helper tool that verify the validity of credit card numbers.

Project description

LuhnChecker - Credit Card Validation and Generation

Build Status

LuhnChecker is a Python library for validating, generating, and processing credit card numbers. This package provides a simple interface to implement the Luhn algorithm (also known as the mod 10 algorithm) which is widely used for validation of identification numbers.

Features

  • Validate credit card numbers using the Luhn algorithm.
  • Generate valid credit card numbers for testing purposes.
  • Mask credit card numbers for secure display.
  • Determine the credit card issuer from the card number.

Installation

To install LuhnChecker, simply use pip:

pip install luhnchecker

Usage

Here's how to use LuhnChecker in your Python code:

Validating a Credit Card Number

from luhnchecker.luhn import Luhn

card_number = "1234567812345670"
if Luhn.check_luhn(card_number):
    print(f"{card_number} is a valid credit card number.")
else:
    print(f"{card_number} is an invalid credit card number.")

Generating a Credit Card Number

generated_card_number = Luhn.generate_luhn()
print(f"Generated card number: {generated_card_number}")

Masking a Credit Card Number

masked_number = Luhn.mask_card_number(card_number)
print(f"Masked card number: {masked_number}")

Determining the Credit Card Issuer

issuer = Luhn.credit_card_issuer(card_number)
print(f"The issuer of the card number {card_number} is {issuer}.")

Contributing

We welcome contributions to LuhnChecker! Here's how you can set up the project for development:

  1. Clone the repository:
    git clone https://github.com/software-students-fall2023/3-python-package-exercise-111
    
  2. Navigate to the project directory:
    cd 3-python-package-exercise-111
    
  3. Install the project along with its development dependencies using pipenv:
    pipenv install --dev
    
  4. Activate the virtual environment:
    pipenv shell
    
  5. Make changes and run the tests to ensure everything is working:
    pytest
    

Team

License

Distributed under the GNU General Public License v3.0. See LICENSE for more information.

PyPI

LuhnChecker is also available through the Python Package Index (PyPI):

luhnchecker on PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

luhnchecker-0.0.12.tar.gz (43.7 kB view hashes)

Uploaded Source

Built Distribution

luhnchecker-0.0.12-py3-none-any.whl (29.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page