Update README with a new "weaknesses" section and commit hash example

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-05-30 12:44:08 -07:00
parent 2726f2d80f
commit 7990c9ad6a
2 changed files with 51 additions and 40 deletions

View File

@@ -25,6 +25,10 @@ No dependencies required, everything is vanilla Python >=3.10.
`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.
@@ -39,6 +43,13 @@ checksum of a file from the internet. The goal of this project is to give more f
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.

View File

@@ -1,42 +1,42 @@
<svg width="256" height="160" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="32" height="32" fill="hsl(300.00,100.00%,3.00%)" />
<rect x="32" y="0" width="32" height="32" fill="hsl(300.00,100.00%,30.00%)" />
<rect x="64" y="0" width="32" height="32" fill="hsl(300.00,100.00%,17.00%)" />
<rect x="96" y="0" width="32" height="32" fill="hsl(300.00,100.00%,23.00%)" />
<rect x="128" y="0" width="32" height="32" fill="hsl(300.00,100.00%,27.00%)" />
<rect x="160" y="0" width="32" height="32" fill="hsl(300.00,100.00%,17.00%)" />
<rect x="192" y="0" width="32" height="32" fill="hsl(300.00,100.00%,10.00%)" />
<rect x="224" y="0" width="32" height="32" fill="hsl(300.00,100.00%,20.00%)" />
<rect x="0" y="32" width="32" height="32" fill="hsl(300.00,100.00%,33.00%)" />
<rect x="32" y="32" width="32" height="32" fill="hsl(300.00,100.00%,33.00%)" />
<rect x="64" y="32" width="32" height="32" fill="hsl(300.00,100.00%,17.00%)" />
<rect x="96" y="32" width="32" height="32" fill="hsl(300.00,100.00%,3.00%)" />
<rect x="128" y="32" width="32" height="32" fill="hsl(300.00,100.00%,27.00%)" />
<rect x="160" y="32" width="32" height="32" fill="hsl(300.00,100.00%,30.00%)" />
<rect x="192" y="32" width="32" height="32" fill="hsl(300.00,100.00%,20.00%)" />
<rect x="224" y="32" width="32" height="32" fill="hsl(300.00,100.00%,30.00%)" />
<rect x="0" y="64" width="32" height="32" fill="hsl(300.00,100.00%,33.00%)" />
<rect x="32" y="64" width="32" height="32" fill="hsl(300.00,100.00%,37.00%)" />
<rect x="64" y="64" width="32" height="32" fill="hsl(300.00,100.00%,23.00%)" />
<rect x="96" y="64" width="32" height="32" fill="hsl(300.00,100.00%,23.00%)" />
<rect x="128" y="64" width="32" height="32" fill="hsl(300.00,100.00%,37.00%)" />
<rect x="160" y="64" width="32" height="32" fill="hsl(300.00,100.00%,47.00%)" />
<rect x="192" y="64" width="32" height="32" fill="hsl(300.00,100.00%,3.00%)" />
<rect x="224" y="64" width="32" height="32" fill="hsl(300.00,100.00%,50.00%)" />
<rect x="0" y="96" width="32" height="32" fill="hsl(300.00,100.00%,20.00%)" />
<rect x="32" y="96" width="32" height="32" fill="hsl(300.00,100.00%,10.00%)" />
<rect x="64" y="96" width="32" height="32" fill="hsl(300.00,100.00%,13.00%)" />
<rect x="96" y="96" width="32" height="32" fill="hsl(300.00,100.00%,7.00%)" />
<rect x="128" y="96" width="32" height="32" fill="hsl(300.00,100.00%,0.00%)" />
<rect x="160" y="96" width="32" height="32" fill="hsl(300.00,100.00%,23.00%)" />
<rect x="192" y="96" width="32" height="32" fill="hsl(300.00,100.00%,43.00%)" />
<rect x="224" y="96" width="32" height="32" fill="hsl(300.00,100.00%,43.00%)" />
<rect x="0" y="128" width="32" height="32" fill="hsl(300.00,100.00%,20.00%)" />
<rect x="32" y="128" width="32" height="32" fill="hsl(300.00,100.00%,33.00%)" />
<rect x="64" y="128" width="32" height="32" fill="hsl(300.00,100.00%,20.00%)" />
<rect x="96" y="128" width="32" height="32" fill="hsl(300.00,100.00%,47.00%)" />
<rect x="128" y="128" width="32" height="32" fill="hsl(300.00,100.00%,27.00%)" />
<rect x="160" y="128" width="32" height="32" fill="hsl(300.00,100.00%,50.00%)" />
<rect x="192" y="128" width="32" height="32" fill="hsl(300.00,100.00%,40.00%)" />
<rect x="224" y="128" width="32" height="32" fill="hsl(300.00,100.00%,30.00%)" />
<rect x="0" y="0" width="32" height="32" fill="hsl(30.00,100.00%,7.00%)" />
<rect x="32" y="0" width="32" height="32" fill="hsl(30.00,100.00%,23.00%)" />
<rect x="64" y="0" width="32" height="32" fill="hsl(30.00,100.00%,7.00%)" />
<rect x="96" y="0" width="32" height="32" fill="hsl(30.00,100.00%,20.00%)" />
<rect x="128" y="0" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="160" y="0" width="32" height="32" fill="hsl(30.00,100.00%,7.00%)" />
<rect x="192" y="0" width="32" height="32" fill="hsl(30.00,100.00%,43.00%)" />
<rect x="224" y="0" width="32" height="32" fill="hsl(30.00,100.00%,27.00%)" />
<rect x="0" y="32" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="32" y="32" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="64" y="32" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="96" y="32" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="128" y="32" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="160" y="32" width="32" height="32" fill="hsl(30.00,100.00%,43.00%)" />
<rect x="192" y="32" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="224" y="32" width="32" height="32" fill="hsl(30.00,100.00%,3.00%)" />
<rect x="0" y="64" width="32" height="32" fill="hsl(30.00,100.00%,33.00%)" />
<rect x="32" y="64" width="32" height="32" fill="hsl(30.00,100.00%,33.00%)" />
<rect x="64" y="64" width="32" height="32" fill="hsl(30.00,100.00%,7.00%)" />
<rect x="96" y="64" width="32" height="32" fill="hsl(30.00,100.00%,43.00%)" />
<rect x="128" y="64" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="160" y="64" width="32" height="32" fill="hsl(30.00,100.00%,13.00%)" />
<rect x="192" y="64" width="32" height="32" fill="hsl(30.00,100.00%,30.00%)" />
<rect x="224" y="64" width="32" height="32" fill="hsl(30.00,100.00%,30.00%)" />
<rect x="0" y="96" width="32" height="32" fill="hsl(30.00,100.00%,20.00%)" />
<rect x="32" y="96" width="32" height="32" fill="hsl(30.00,100.00%,50.00%)" />
<rect x="64" y="96" width="32" height="32" fill="hsl(30.00,100.00%,43.00%)" />
<rect x="96" y="96" width="32" height="32" fill="hsl(30.00,100.00%,7.00%)" />
<rect x="128" y="96" width="32" height="32" fill="hsl(30.00,100.00%,3.00%)" />
<rect x="160" y="96" width="32" height="32" fill="hsl(30.00,100.00%,33.00%)" />
<rect x="192" y="96" width="32" height="32" fill="hsl(30.00,100.00%,10.00%)" />
<rect x="224" y="96" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="0" y="128" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="32" y="128" width="32" height="32" fill="hsl(30.00,100.00%,3.00%)" />
<rect x="64" y="128" width="32" height="32" fill="hsl(30.00,100.00%,17.00%)" />
<rect x="96" y="128" width="32" height="32" fill="hsl(30.00,100.00%,3.00%)" />
<rect x="128" y="128" width="32" height="32" fill="hsl(30.00,100.00%,40.00%)" />
<rect x="160" y="128" width="32" height="32" fill="hsl(30.00,100.00%,33.00%)" />
<rect x="192" y="128" width="32" height="32" fill="hsl(30.00,100.00%,0.00%)" />
<rect x="224" y="128" width="32" height="32" fill="hsl(30.00,100.00%,17.00%)" />
</svg>

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB