An helper tool that verify the validity of credit card numbers.
Project description
LuhnChecker - Credit Card Validation and Generation
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:
- Clone the repository:
git clone https://github.com/software-students-fall2023/3-python-package-exercise-111
- Navigate to the project directory:
cd 3-python-package-exercise-111
- Install the project along with its development dependencies using pipenv:
pipenv install --dev
- Activate the virtual environment:
pipenv shell
- 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):
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for luhnchecker-0.0.12-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ad1f1c55f5803d31c52d7ad72ff84716a725e814683ab741506abbae57b593f |
|
MD5 | 6a3c6a79d0d9e8b750febe439cdd3424 |
|
BLAKE2b-256 | 91e25f6e0cd9ccf47729fc2e6b6c3168240e20ae1a07c97b00168b9bcbb7a0e0 |