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]] [-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]'

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.2.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hashime-0.2.0-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: hashime-0.2.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hashime-0.2.0.tar.gz
Algorithm Hash digest
SHA256 7a9773c350af3ebfae93c4162ac57b26f04753d7bf73defc34033d390019968f
MD5 04ec443d723adae45997488b32f26e9e
BLAKE2b-256 5513aaa7280532d44a950b74974ce389187ceec5993b9efacc0d114b776d8a2f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hashime-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for hashime-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8a5f4f580004e25c351b0d5ad57974ede0a086af230511f11a705cfa1047e99b
MD5 9c8d42f855b547b06cb8d9ad01e24f27
BLAKE2b-256 4b552cac2f390fe9afb69461000577a3f17dc9b5542472769cc9efbd66ee05aa

See more details on using hashes here.

Supported by

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