Alek Ratzloff ae288b06df Add git add and ANSI output to gencommit.sh
Usually you want to `git add` when you run gencommit.sh, so that has
been added.

Also, add ANSI output because I like to see what we're generating while
in the terminal.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
2024-05-31 22:26:39 -07:00
2024-05-31 09:51:18 -07:00
2024-05-31 09:51:18 -07:00

colorhash

Hash of the previous commit hash

A tool for creating distinct art based on input data or hash.

Usage

  1. Clone the repository
  2. Run using python -m colorhash -h for usage.

No dependencies required, everything is vanilla Python >=3.10.

Example usage

Create art using the default "nibble" art algorithm, printing out to the terminal

python -m colorhash infile.dat

Create art using the OpenSSH "randomart" art algorithm, writing to an SVG file

python -m colorhash infile.dat -y svg -o out.svg -m randomart

Create art using an MD5 hash instead of the default SHA512

python -m colorhash infile.dat -y svg -o out.svg -a md5

Create art in the terminal using the current git commit hash

python -m colorhash "$(git rev-parse HEAD)" -a sha1

Motivation

If you see the picture is different, the key is different.

If the picture looks the same, you still know nothing.

(From OpenSSH sshkey.c fingerprint_randomart() function)

Cryptographic hashes are often visually distinct, however, sometimes they are not. This can become vitally important in matters of security, when you are comparing two key hashes or verifying the checksum of a file from the internet. The goal of this project is to give more fuel for human pattern recognition so that two extremely similar hashes, maliciously crafted or not, have more visual depth to their distinction.

Weaknesses

This is not a perfect solution for hash comparison. Similar hashes may just so happen to choose the same color palette, for example. Additionally, if this is appearing on a webpage, caches may override the most recent version of the file; this has happened with me and Chrome looking at the Github page for this project.

Examples

See the examples directory.

License

Code is licensed under GPLv3.

Since images are representation of a specific hash, all of the SVG files in the examples/ directory are under CC0/public domain.

Description
Making art with cryptographic hashes
Readme 1.6 MiB
Languages
Python 59.7%
JavaScript 29.4%
HTML 8.1%
Shell 2.8%