Skip to main content

Base45 (rfc9285) encoding and decoding for more efficient data transfer via QR codes

Project description

This repository contains b45 - a Python package and CLI for encoding/decoding data from/into Base45.

Base45 is specified in rfc9285 and it's main use case is storing arbitrary data more space-efficiently in QR codes.

So this helps when transferring snippets from/to an air-gapped computer via QR codes.

Invocation

You can directly invoke b45 from the cloned repository working directory like this:

python -m b45  -h

Alternatively, you can install the package with pip and then the b45 command line front end is installed as well.

Example:

zstd -c /bin/zstdgrep  | b45  | qrencode -t utf8

How much does it really save

In comparison to Base64 over QR code it saves up to 25 % or so.

Quick test:

{ echo '5 k'; for i in b45 base64 ; do head -c 1536 /dev/urandom | $i | qrencode -t utf8 | wc -c ; done ; echo '/ 100 * p'; } | dc

Yields for example:

75.55200

(per cent of final QR code size)

Related Work

There is also the base45 python package. Main differences:

  • b45 implements encoding and decoding using Numpy vector operations and thus runs faster
  • b45 supports non-standard little-endian Base45 variant
  • the b45 command line front-end also supports directly reading and writing from/to files, whereas python-base45 only supports stdin and stdout

The Python bases package implements various binary-to-text encodings in a generic way, including Base45, but it doesn't come with a command line frontend.

License

This packaged is licensed under the Boost Software License Version 1 (BSL-1.0).

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

b45-0.2.3.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file b45-0.2.3.tar.gz.

File metadata

  • Download URL: b45-0.2.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for b45-0.2.3.tar.gz
Algorithm Hash digest
SHA256 25df7c596c217768c882d50e1bb121bdfd15f64897111b8cb795a6a3663b8d11
MD5 744da1b5269e4e551f6792794b00524b
BLAKE2b-256 65dae7b003f33a28b493ffe00e6872c0573f08ffe2985b14a36223dfa7279502

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