Create an image from a MD5, SHA512 or SHAKE256 hash
Project description
Hashpic
Hashpic creates an image from the MD5 hash of your input.
Since v0.2.0 it is also possible to create an image from a SHA-512 hash.
Since v0.3.0 it is also possible to create an image from a SHAKE-256 hash with variable digest length of 4, 16, 25, 36, 64, 100 or 225.
Since v0.3.5 it is also possible to create an image from a SHA3-512 and a BLAKE2b hash.
Install
pip3 install hashpic
Usage
> python3 -m hashpic 'Hashpic rocks!'
This should create a file output.png
in your current directory.
The input Hashpic rocks!
should create the following image:
Piping from another program
All this commands should produce the same image as above.
> printf 'Hashpic rocks!' | md5 | python3 -m hashpic --bypass
> printf 'Hashpic rocks!' | python3 -m hashpic
Console Mode
Hashing a file
It is also possible to create an image from a hash of a file. Use the --file
argument for that.
> python3 -m hashpic --file README.md
SHA-512 Mode
It is also possible to create an image from a SHA-512 hash. All arguments for MD5 Mode are also available for SHA512 Mode.
> python3 -m hashpic --sha512 'Hashpic rocks!'
> printf 'Hashpic rocks!' | python3 -m hashpic --sha512
This commands should create the following image:
SHAKE256 Mode
You can create an image from a SHAKE256 hash with variable digest lengths. Valid lengths are 4, 16, 25, 36, 64, 100 and 225. You must specify the length of the digest if you want to create an image from a SHAKE256 hash.
> python3 -m hashpic --shake256 --length 100 'Hashpic rocks!'
The command above should produce the following image:
The `--slow` flag
--slow
flag
You can use the --slow
flag to run a generalized method instead of a hardcoded one. But this have some performance issues.
Hardcoded:
Generalized:
More SHAKE256 examples
Click to see more examples.
Digest Length of 4
> python3 -m hashpic --shake256 --length 4 'Hashpic rocks!'
Digest Length of 16
> python3 -m hashpic --shake256 --length 16 'Hashpic rocks!'
Digest Length of 25
> python3 -m hashpic --shake256 --length 25 'Hashpic rocks!'
Digest Length of 36
> python3 -m hashpic --shake256 --length 36 'Hashpic rocks!'
Digest Length of 64
> python3 -m hashpic --shake256 --length 64 'Hashpic rocks!'
Digest Length of 225
Maybe this command will take a few seconds to complete.
> python3 -m hashpic --shake256 --length 225 'Hashpic rocks!'
SHA3 Mode
It is possible to create an image from a SHA3 hash.
> python3 -m hashpic 'Hashpic rocks!' --sha3
BLAKE2b Mode
It is possible to create an image from a BLAKE2b hash.
> python3 -m hashpic 'Hashpic rocks!' --blake2b
Examples
Bypassing a hash directly:
> python3 -m hashpic ff00ff00ff00ff0000ff00ff00ff00ffff00ff00ff00ff0000ff00ff00ff00ffff00ff00ff00ff0000ff00ff00ff00ffff00ff00ff00ff0000ff00ff00ff00ff --bypass --sha512
This command will produce the following image:
So we can call the hash above the so called chessboard hash
.
You can also bypass a hash from another program:
Disclaimer
The color palette in data.py
was copied from and influenced by the string-color
library.
Thanks for this!
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.