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] [--width WIDTH]
               [--height HEIGHT] [--no-frame] [--frame-top-text TOP_TEXT]
               [--frame-bottom-text BOTTOM_TEXT] [--frame-lines LINES]
               [--frame-corners CORNERS] [--frame-brackets BRACKETS] [-d]
               [-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 and hashing functions and
                        exit
  -a ALGO, --algorithm ALGO
                        visualization algorithm (defaults to DrunkenBishop)
  -H HASH, --hash-function HASH
                        hashing function (defaults to sha256)
  --width WIDTH         visualization width
  --height HEIGHT       visualization height
  --no-frame            output visualization without a frame
  --frame-top-text TOP_TEXT
                        text on the top frame line
  --frame-bottom-text BOTTOM_TEXT
                        text on the bottom frame line
  --frame-lines LINES   comma-separated frame side symbols in a clockwise order
                        from the top
  --frame-corners CORNERS
                        comma-separated frame corner symbols in a clockwise
                        order from the top-left
  --frame-brackets BRACKETS
                        comma-separated symbols surrounding frame text
  -d, --digest          output digest
  -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_path('./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.0.1.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

hashime-0.0.1-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for hashime-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9111c5630944f3884891c3394d6556d47ae3b8dc54f0855ab2e4c08667e9a19c
MD5 c775b1ff1bdc19c7d65146d2adf8ee3f
BLAKE2b-256 0455992a9c3c8dc4cb0c9a4060c76c155e24d8c9fbf92c0a94ea0a6baff60f55

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for hashime-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 79d55dc4e397f5fdac6565c04588ba9d1744881507b9841ff10227962b209add
MD5 b25b2091757876f526670993b66bbadf
BLAKE2b-256 df3a64f4c9f99ce83e9317badd1cf3cee087805ec35ae62e7be965dc8ae6a180

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