Skip to main content

hashime

CI

Hash visualization tool inspired by beautiful ssh-keygen randomart.

How can something so soulless be so pretty?

Installation

From PyPI:

pip install hashime

From git:

pip install git+https://github.com/sakhezech/hashime

Usage as CLI

hashime ... or python -m hashime ...

$ hashime -h
usage: hashime [-h] [-v] [-l] [-a ALGO] [-H HASH] [--frame FRAME | --no-frame]
               [--top-text TOP_TEXT] [--bottom-text BOTTOM_TEXT]
               [-d [DIGEST_FORM]] [-o OUT]
               [file]

hash visualization tool

positional arguments:
  file                  input file (defaults to stdin)

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -l, --list            show visualization algorithms, hashing functions,
                        digest forms and exit
  -a ALGO, --algorithm ALGO
                        visualization algorithm (defaults to drunken_bishop)
  -H HASH, --hash-function HASH
                        hashing function (defaults to sha256)
  --frame FRAME         comma-separated frame characters in order of
                        (top_line, right_line, bottom_line, left_line,
                        top_left_corner, top_right_corner,
                        bottom_right_corner, bottom_left_corner, left_bracket,
                        right_bracket)
  --no-frame            output visualization without a frame
  --top-text TOP_TEXT   text on the top frame line
  --bottom-text BOTTOM_TEXT
                        text on the bottom frame line
  -d [DIGEST_FORM], --digest [DIGEST_FORM]
                        show digest (defaults to base64)
  -o OUT, --output OUT  output file (defaults to stdout)

$ hashime -H md5 -d base64 LICENSE
+----[LICENSE]----+
|                 |
|         .       |
|  . .   o        |
| . = o +         |
|  * * + S        |
| o O +           |
|  * = +          |
| . + = .         |
|    E .          |
+------[MD5]------+
md5: lGqJe4ZYqSXluPYkZOH/oQ==

Usage in code

>>> import hashime
>>> bishop = hashime.DrunkenBishop()
>>> bishop.update_from_file_hash('./LICENSE')
>>> art = bishop.to_art(
...     top_text='LICENSE',
...     bottom_text='SHA256',
...     brackets=('<', '>'),
...     lines=('═', '│', '─', '║'),
...     corners=('╔', '╕', '┘', '╙'),
... )
>>> print(art)
╔════<LICENSE>════╕
║    ..o +        │
║   o E.= o       │
║  o +.. o        │
║ . o o.o         │
║.   o =.S.       │
║..   o.+..+      │
║o.  o.oo+..=     │
║. . *+=..+o o .  │
║  .=+O.++  . o.. │
╙─────<SHA256>────┘

Development

Use ruff check --fix . and ruff format . to check and format your code.

To get started:

git clone https://github.com/sakhezech/hashime
cd hashime
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'

Metadata

Release files for hashime 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hashime 0.2.0
File Size Uploaded
hashime-0.2.0.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hashime 0.2.0
File Interpreter ABI Platform
hashime-0.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 16.9 kB

Release files / hashime-0.2.0.tar.gz

Download URL hashime-0.2.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7a9773c350af3ebfae93c4162ac57b26f04753d7bf73defc34033d390019968f
BLAKE2b-256 checksum
How to use checksums
5513aaa7280532d44a950b74974ce389187ceec5993b9efacc0d114b776d8a2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / hashime-0.2.0-py2.py3-none-any.whl

Download URL hashime-0.2.0-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8a5f4f580004e25c351b0d5ad57974ede0a086af230511f11a705cfa1047e99b
BLAKE2b-256 checksum
How to use checksums
4b552cac2f390fe9afb69461000577a3f17dc9b5542472769cc9efbd66ee05aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

0.0.1

2 release files

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