Python library to generate randomart of a bytes string
Project description
pyrandomart
Python library to produce randomart text from a bytes object
This module contains a function to turn a bytes object into a randomart string. see: http://www.dirk-loss.de/sshvis/drunken_bishop.pdf for a description of randomart
Installation
Try either:
pip install pyrandomart
or directly from github
pip install git+https://github.com/aaronm6/pyrandomart.git
Usage
The only function in this package that is useful to import is the last one, 'randomart'. So the recommended usage is:
>>> from pyrandomart import randomart
randomart's call signature and explantion of inputs:
randomart(bStr, header='RSA 4096', footer='SHA256', dims=(9, 17), box='clean')
bStr: Bytes object with the hash to be turned into randomartheader: Str object to be displayed at the header of the randomart boxfooter: Str object to be displayed at the footer of the randomart boxdims: List or tuple object with dimensions of the randomart box (rows, columns). Dims must be odd ints.box: Describes the characters that make up the border of the randomart box. Input value can be 'clean' or 'simple', or a custom dict object can be provided.
For example, to turn a bytes object consisting of byte values 30 through 60 into randomart and print:
>>> bobj = bytes(range(30,60))
>>> print(randomart(bobj, header='30-60', footer='no hash'))
┏━━━━━[30-60]━━━━━┓
┃@===+o. ┃
┃XO.*+... ┃
┃= o o . . ┃
┃Xo . . ┃
┃+Oo S . ┃
┃BE. . o . ┃
┃=o. . . ┃
┃o. ┃
┃.o. ┃
┗━━━━[no hash]━━━━┛
Notes
- The randomart here corresponds to the bytes given in bytes-object bStr. However, often a cryptographic hash is given in the base64 representation of the bytes (e.g. when generating an ssh key). In this case, one can simply import the standard library 'base64' and decode the base64 hash to bytes using
base64.b64decode(..)and then pass the result to this randomart function. - The number of columns should be large enough to accommodate the header and footer provided. However, this is not explicitly checked, because it's your life. The function will still work if not, but it may look funky.
Project details
Release history Release notifications | RSS feed
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 pyrandomart-1.1.1.tar.gz.
File metadata
- Download URL: pyrandomart-1.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f35f08ff42dee0a1c8f00db5e89fe7bf549507ba3ab1132b3508705e98672d8
|
|
| MD5 |
9056740c080954a627588cec48cc7178
|
|
| BLAKE2b-256 |
8d106a61a1a23ca8d30786679630b970110cba09c4d338a439cd19505c578e48
|
File details
Details for the file pyrandomart-1.1.1-py3-none-any.whl.
File metadata
- Download URL: pyrandomart-1.1.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbe9a2dc736ec883345d809df22a2b28b9b89fceff44f6a7b9c428e841420d30
|
|
| MD5 |
8e7bb18cac1d8944ed8552515306f1b0
|
|
| BLAKE2b-256 |
30eaafe3c8a3104eb7f37cbb799e77280366994660136a8801fce195fbb48d2e
|