Giter Club home page Giter Club logo

damm32's Introduction

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.

damm32's People

Contributors

dependabot-support avatar trickeydan avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

damm32's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.