anscd/shape-hash
最新稳定版本:v1.0.0
Composer 安装命令:
composer require anscd/shape-hash
包简介
A library to generate deterministic SVG images from strings.
README 文档
README
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()andunpack()functions).
Credits
Visualizations inspired by beautiful circles from https://github.com/danfinlay/jazzicon
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: ISC
- 更新时间: 2026-03-18