Metadata-Version: 2.4
Name: b45
Version: 0.2.3
Summary: Base45 (rfc9285) encoding and decoding for more efficient data transfer via QR codes
Author-email: Georg Sauthoff <mail@gms.tf>
License-Expression: BSL-1.0
Project-URL: Homepage, https://codeberg.org/gms/b45
Project-URL: Issues, https://codeberg.org/gms/b45/issues
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Text Processing :: Filters
Classifier: Topic :: Utilities
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"

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

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

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][pypi-base45] python package. Main
differences:

- b45 implements encoding and decoding using [Numpy][np]
  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][pypi-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][bsl]).



[rfc]: https://www.rfc-editor.org/rfc/rfc9285.txt
[qr]: https://en.wikipedia.org/wiki/QR_code
[base]: https://en.wikipedia.org/wiki/Binary-to-text_encoding
[pypi-base45]: https://pypi.org/project/base45/
[pypi-bases]: https://pypi.org/project/bases/
[np]: http://www.numpy.org/
[bsl]: https://spdx.org/licenses/preview/BSL-1.0.html

