Skip to main content

Generate ASCII randomart by hashing input with BLAKE2b and using an adapted drunken bishop alogirthm.

Project description


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.


Install with pip directly from GitHub:

pip install git+


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!' |

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

[^1]: "Perrig A. and Song D., 1999, International Workshop on Cryptographic Techniques and E-Commerce (CrypTEC '99)"

[^2]: "Dirk Loss, Tobias Limmer, Alexander von Gernler, 2009"

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

randomart-0.2.3.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

randomart-0.2.3-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page