skillfed

luhn

Generate and verify Luhn check digits

luhn v0.2.0 178.4K downloads/30d#10,195 on PyPI49
Permissive license MIT Abandoned released

What it is and what it does

Luhn is a minimal Python library that implements the Luhn algorithm, a checksum formula used to validate identification numbers like credit card numbers. It provides three functions: `verify()` to check whether a digit string has a valid Luhn check digit, `generate()` to compute the correct check digit for a given number, and `append()` to return the number with its check digit appended.

The package has no external dependencies and is straightforward to use. However, it has been abandoned since its single release on 2015-06-23, with no updates for many years. While the algorithm itself is simple and unlikely to change, the lack of maintenance means any compatibility issues with newer Python versions or edge cases would not be addressed by the maintainer.

Use it for:

  • Validate credit card numbers or other financial identifiers that use Luhn checksums before processing.
  • Generate correct check digits for test data or synthetic credit card numbers in development environments.
  • Verify the integrity of digit sequences in payment systems or identity verification workflows.
  • Append Luhn check digits to partial account numbers or identifiers in data generation pipelines.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates and verifies Luhn check digits for digit strings, commonly used to validate credit card numbers and similar identifiers.

Yes, but with caution. The package does exactly what it claims and has no known vulnerabilities. MIT licensing is unrestricted. However, it is abandoned and has not been updated since 2015-06-23—install only if you are confident the Luhn algorithm implementation is correct for your use case and you can tolerate no future maintenance. For production payment systems, consider whether a maintained alternative would be safer.

Install

luhn on PyPI

pip

pip install luhn

uv

uv add luhn

poetry

poetry add luhn

Installing luhn

Before you install

High install friction: the package has been abandoned since its only release on 2015-06-23, with no updates in many years. The last repository commit was 2023-03-14, suggesting minimal maintenance. No runtime dependencies, so installation itself is straightforward, but the stagnation raises questions about whether bugs or compatibility issues would be addressed.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or redistribution in commercial or private projects.

Quickstart

pip install luhn

from luhn import verify, generate, append

verify('356938035643809')  # True
generate('53461861341123')  # 4
append('53461861341123')  # '534618613411234'

Verify before relying

  • Whether the package works correctly with modern Python versions, given no updates since 2015-06-23 and no specified Python support in metadata.
  • Whether the Luhn algorithm implementation matches current standards or has any known edge cases not covered by the fact sheet.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 4,070 days since the last release
Last repo commit
First released
Downloads 178,384/month — #10,195 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: luhn-0.2.0.tar.gz

Tags

luhn check digit validationcredit card number verificationluhn algorithm implementationgenerate check digitsverify checksum digit
checksum-validationfinancial-data

More Cryptography packages