bishopviz
Drunken Bishop algorithm implementation for random ASCII art generation from md5 hashes, and for data visualization from generated art.
Installation
(Recommended) If you have pipx installed:
pipx install bishopviz
Otherwise:
pip install bishopviz
Or, to use the web version, go to https://bishopviz.streamlit.app
Try it
Web App
The web app is the same algorithm, but shows some data visualizations about it.
Go to the website, type anything into the text area, and then do ctrl+Enter.
CLI
A quick demo of the colors and animation:
bishopviz -a 0.1 -C
To specify a file to generate randomart for, add the -f flag and then specify a file path.
To see all of the options of the CLI, run:
bishopviz --help
Features
- md5 hash from a random string or a file
- Implementation of the drunken bishop algorithm to generate randomart
- Various character sets (like texture packs!) for the final graph
- Visualize the algorithm over time via animations and generation count
- (CLI) Graph with colors representing the visit frequency
- (Webapp) Web App with data visualizations from the algorithm
CLI Help Menu
Usage: bishopviz [OPTIONS]
Drunken Bishop algorithm implementation for random ASCII art generation from
md5 hashes.
Options:
-f, --file-feed TEXT Use the contents of any file as the input.
-a, --animate FLOAT Display the algorithm's progress as an animation, with
the specified number of seconds as the interval
between frames.
-c, --charset TEXT Use a different character set for the graph. Options:
ascii, ascii_alt, emoji, emoji2, emoji3, emoji4,
greek, cyrillic, katakana, math, blocks, faces, cars,
plants [default: ascii]
-C, --colors Whether to colorize the output.
-d, --data Open a Streamlit app to run the algorithm and
visualize data.
--no-start-end Don't show the start and end positions on the graph.
-h, --help Show this message and exit.
How It Works
For a better explanation, check out this awesome paper on the topic.
First, an md5 hash is generated from the input (this can be text, an image, video, etc.). This hash is then encoded into 128 bits, and then split into 64 pairs of 2 bits each.
The algorithm generates a 2-dimensional 17x9 matrix and then tracks the position of a "bishop", which starts off in the middle of the matrix.
It will iterate over the byte pairs and move in a certain direction depending on the pair:
| Bit | Direction |
|---|---|
| 00 | Up, Left |
| 01 | Up, Right |
| 10 | Down, Left |
| 11 | Down, Right |
My program, while iterating over the pairs, will track certain variables to then create data visualizations using Streamlit and Plotly.
Technologies/Libraries Used
- Streamlit, to create the web app
- Plotly, to create the graphs
- Pandas, to manipulate the data generated by the algorithm
- Click, for the CLI
- The drunken bishop: An analysis of the OpenSSH fingerprint visualization algorithm by Loss et al. for insights on how the algorithm worked
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bishopviz-1.0.1.tar.gz.
File metadata
- Download URL: bishopviz-1.0.1.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c49d238752f44970777eaafd0ee81d10ab95dcfe411b3fb3b52fe1be5fce325f
|
|
| MD5 |
07effb5c163e7c39d48a49dd49f12746
|
|
| BLAKE2b-256 |
d8bf4dff5a482aa5b876d181606c377be803812effb16764d88507c0591f2f67
|
File details
Details for the file bishopviz-1.0.1-py3-none-any.whl.
File metadata
- Download URL: bishopviz-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8897819e85297c0c913e9d450e3887a728542c7e3eb52f39f09f6698b6def07
|
|
| MD5 |
4903ba81a22e96149dc8e7bb54d9b6b4
|
|
| BLAKE2b-256 |
edf6d2b56e26447ce40c765068339ad6f3acebf3d10c2d3f26734bcc35babd33
|