Skip to content

binary-data/shapehash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ShapeHash

A deterministic hash visualization tool inspired by the "Hash Visualization: a New Technique to improve Real-World Security" paper by Perrig and Song.

Purpose

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.

Features

  • 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.

Installation

No installation or dependencies are required. Ensure you have PHP installed on your system.

Usage

Run the script from your terminal:

php hash.php "your input string"

Options

  • -o, --outfile <path>: Specify the output file path (default: out.svg).
  • -h, --help: Show help information.

Examples

Generate a visualization for "Hello World":

php hash.php "Hello World" -o hello.svg

Generate a visualization with the default output name (out.svg):

php hash.php "unique identity"

Requirements

  • PHP 7.4 or higher (for hash() and unpack() functions).

Credits

Visualizations inspired by beautiful circles from https://github.com/danfinlay/jazzicon

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages