A deterministic hash visualization tool inspired by the "Hash Visualization: a New Technique to improve Real-World Security" paper by Perrig and Song.
ShapeHash converts any input string into a unique, deterministic SVG image. It uses an SHA-256 based PRNG to ensure that the same input string always produces the exact same visualization. The resulting image is a circular composition of overlapping basic shapes (triangles, squares, and circles) with varying colors and opacities, designed to be easily distinguishable by humans.
- Deterministic: Same input always yields the same image.
- Visual Clarity: Uses a 20-color palette with contrast checks to ensure distinct shapes.
- Zero Dependencies: Pure PHP implementation with no external libraries or extensions required for SVG generation.
- CLI Interface: Easy to use from the command line.
No installation or dependencies are required. Ensure you have PHP installed on your system.
Run the script from your terminal:
php hash.php "your input string"-o, --outfile <path>: Specify the output file path (default:out.svg).-h, --help: Show help information.
Generate a visualization for "Hello World":
php hash.php "Hello World" -o hello.svgGenerate a visualization with the default output name (out.svg):
php hash.php "unique identity"- PHP 7.4 or higher (for
hash()andunpack()functions).
Visualizations inspired by beautiful circles from https://github.com/danfinlay/jazzicon