Skip to main content

randomart.py

CodeFactor

A script to present BLAKE2b hashes as small ASCII-art pictures, similarly to OpenSSH's randomart.

This allows easier verification by humans but may not be as secure as a bytewise comparison of the digest!

See the paper [Hash Visualization: a New Technique to improve Real-World Security1]1 for more information on the concept of random art.

The paper [The drunken bishop: An analysis of the OpenSSH fingerprint visualization algorithm2]2 analyses the OpenSSH implementation in more detail.

It should be explicitly noted that my algorithm is similar but not identical to the "drunken bishop" walk of the OpenSSH implementation. The implementation at hand:

  • flips sides at the borders, which turns the field into a torus
  • moves in all possible directions with distance 1, not only diagonally
  • does not mark start (S) and end (E) and uses a different character palette

I have not performed any similar analysis[2]2 but would expect my implementation to perform no worse.

installation

Install with pip directly from GitHub:

pip install git+https://github.com/ansemjo/randomart

usage

The script expects a file in the first positional argument or otherwise simply reads from standard input. It is thus best suitable for usage in a pipe:

echo 'Hello, World!' | randomart.py

There are two flags to control the output:

  • --ascii use only ASCII characters for the box frame
  • --hash - print the computed digest before the randomart picture

Otherwise use randomart.py --help for usage help.

as a library

If you want to use your own hash you can import from random_art.randomart:

from random_art.randomart import draw, drunkenwalk
...

# generate your hash digest
digest = ...

# generate randomart, HASHNAME must be 10 characters
art = draw(drunkenwalk(digest), HASHNAME)
print(art)

http://www.ece.cmu.edu/~adrian/projects/validation/validation.pdf "Perrig A. and Song D., 1999, International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)"

http://www.dirk-loss.de/sshvis/drunken_bishop.pdf "Dirk Loss, Tobias Limmer, Alexander von Gernler, 2009"

  1. ↩
  2. ↩ ↩2

Metadata

Release files for randomart 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 randomart 0.2.3
File Size Uploaded Provenance Actions
randomart-0.2.3.tar.gz 4.6 kB Without provenance Details for randomart-0.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 10.9 kB

Release files / randomart-0.2.3.tar.gz

Download URL randomart-0.2.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ecc58aab305107615dfefde6fb23ed1f38bbc020ba1dee295d39e496861c8fb2
BLAKE2b-256 checksum
How to use checksums
ade8ff0d901ba33f6271263d996dc04b9d60ca0fffe2f833c2c70e779f2bb5ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

Release files / randomart-0.2.3-py3-none-any.whl

Download URL randomart-0.2.3-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cda445023d608b6e3b28f67bf860cb1b6d4e01a311b1c6862c6d53c392e1b000
BLAKE2b-256 checksum
How to use checksums
78a520471b07b035cd4cc66f13e1d428b471918b6dd50d281b8cdcd1bb352dba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.9.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.3

Security for randomart 0.2.3

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files No provenance

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