Skip to main content

Damm32

Tests

Python implementation of the Damm Algorithm in Base 32

By default, it uses an alphabet as specified in RFC 4648 which contains 32 alphanumeric characters, with similar looking characters removed. The padding symbol is not included.

Installation

The package is available on PyPI and can be installed using pip: pip install damm32

It is also available on the Arch User Repository as python-damm32.

Alternatively, you can clone the repository and use the module.

Usage

The module contains a single class called Damm32, this class implements the methods for the checksum.

from damm32 import Damm32

d32 = Damm32()

digit = d32.calculate("HELLO")

d32.verify("HELLO" + digit)

You can also pass an list of length 32 to the constructor for the class to specify your alphabet.

from damm32 import Damm32

d32 = Damm32(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '2', '3', '4', '5', '6', '7'])

How it works

This is an implementation of the Damm Algorithm for use in Base 32 systems.

It will detect all occurrences of the two most frequently appearing types of transcription errors, namely altering one single digit, and transposing two adjacent digits (including the transposition of the trailing check digit and the preceding digit).

Since prepending leading zeros does not affect the check digit, variable length codes should not be verified together since, e.g., 0, 01, and 001, etc. produce the same check digit. However, all checksum algorithms are vulnerable to this.

The implementation uses a bitmask from Table of Low-Weight Binary Irreducible Polynomials to enable calculation of the check digit without constructing the quasigroup.

Metadata

Release files for damm32 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for damm32 1.2.1
File Size Uploaded Provenance
damm32-1.2.1.tar.gz 4.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for damm32 1.2.1
File Interpreter ABI Platform
damm32-1.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / damm32-1.2.1.tar.gz

Download URL damm32-1.2.1.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b101d4b537ce48a684c688a2aa6f58e5917809230118af66de05eecb26a01597
BLAKE2b-256 checksum
How to use checksums
91d86d1983933af307d2754556b5a1992583c0a60237fae20465c1b3fbafef98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Linux/5.10.56-1-lts

Release files / damm32-1.2.1-py3-none-any.whl

Download URL damm32-1.2.1-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63840db7ec4ae8e9945e289e81d6c58341ce1b44ca8ca6485f2696cd58e4df9a
BLAKE2b-256 checksum
How to use checksums
c0e0ac720a9651a4047741a65f98b9e333ec39bcad1272693e3b672d040525c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.8 CPython/3.9.6 Linux/5.10.56-1-lts

Security for damm32 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page