Skip to main content

hash visualization tool

Project description

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]] [-f FILE] [-o OUT]

hash visualization tool

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)
  -f FILE, --file FILE  input file (defaults to stdin)
  -o OUT, --output OUT  output file (defaults to stdout)

$ hashime -H md5 -d -f 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]'

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

hashime-0.1.0.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

hashime-0.1.0-py2.py3-none-any.whl (8.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file hashime-0.1.0.tar.gz.

File metadata

  • Download URL: hashime-0.1.0.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for hashime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4bf7b2400bee4f13e082e79802503882275300253ae3c0ccc0858a165c66b5dd
MD5 4a1725360cdd8bfd0c38afd96e380c5b
BLAKE2b-256 ea1ca9a31cb9c3a760c3cbbc82632e765c6e0a58634d2ba85e4ae6403d6d3991

See more details on using hashes here.

File details

Details for the file hashime-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: hashime-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for hashime-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a2f81b20b33c2dec59347d74d1c525519db49ae4387c67a0a082c60417ea6ff2
MD5 a0c26755ab7b79a466698f30f0edbe03
BLAKE2b-256 99406ae0ea5306080ae8fab2dc66bc8ae84c192f1d30465610d1b3ebddd439e2

See more details on using hashes here.

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