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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file luhnchecker-0.0.12.tar.gz.

File metadata

  • Download URL: luhnchecker-0.0.12.tar.gz
  • Upload date:
  • Size: 43.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for luhnchecker-0.0.12.tar.gz
Algorithm Hash digest
SHA256 ac5969a24cd1f4e0d042eb85eb2d5aca78ce464712a89ff1866d1ecce19dd125
MD5 b78553e6b9fdec0ab44fe3c29616870f
BLAKE2b-256 2e5a033acd3164868771be9943695d4f67b782fc9432f90d5d7fdef32b930f8f

See more details on using hashes here.

File details

Details for the file luhnchecker-0.0.12-py3-none-any.whl.

File metadata

  • Download URL: luhnchecker-0.0.12-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for luhnchecker-0.0.12-py3-none-any.whl
Algorithm Hash digest
SHA256 8ad1f1c55f5803d31c52d7ad72ff84716a725e814683ab741506abbae57b593f
MD5 6a3c6a79d0d9e8b750febe439cdd3424
BLAKE2b-256 91e25f6e0cd9ccf47729fc2e6b6c3168240e20ae1a07c97b00168b9bcbb7a0e0

See more details on using hashes here.

Supported by

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