Skip to main content

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).

Metadata

Release files for b45 0.2.3

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

Source distribution (sdist)

Source distribution for b45 0.2.3
File Size Uploaded
b45-0.2.3.tar.gz 4.5 kB Details

Release files / b45-0.2.3.tar.gz

Download URL b45-0.2.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
25df7c596c217768c882d50e1bb121bdfd15f64897111b8cb795a6a3663b8d11
BLAKE2b-256 checksum
How to use checksums
65dae7b003f33a28b493ffe00e6872c0573f08ffe2985b14a36223dfa7279502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.2.3 This release

1 release file

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