https://github.com/zessx/hashicon
Generate unique icon base on a hash
https://github.com/zessx/hashicon
Last synced: 12 months ago
JSON representation
Generate unique icon base on a hash
- Host: GitHub
- URL: https://github.com/zessx/hashicon
- Owner: zessx
- License: mit
- Created: 2014-04-15T14:37:33.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2020-11-22T10:33:49.000Z (over 5 years ago)
- Last Synced: 2025-01-09T07:13:18.498Z (over 1 year ago)
- Language: PHP
- Homepage: http://work.smarchal.com/hashicon
- Size: 36.1 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

========
HashIcon is a PHP Class which generate unique icon based on a hash.
Icons are generated in a Base64 format.
Functions
---------
``` php
function toIcon($algo, $hash, $size = 300, $format = 'png');
```
Usage
-------
``` php
require 'HashIcon.php';
$hash = hash('sha256', 'Lorem ipsum dolor sit amet.');
$image = HashIcon::toIcon(HashIcon::SHA256, $hash);
header('Content-type:image/png');
echo base64_decode($image);
// or
```

Accepted algorythms
-------------------
- HAVAL-256,3
- HAVAL-256,4
- HAVAL-256,5
- GOST
- RIPEMD-256
- SHA-256
- Snefru
Accepted formats
----------------
- PNG
- JPG
- GIF
TODO-LIST
---------
Add a reverse function : `HashIcon::toHash()`.
Add algorythms :
- Adler-32
- CRC-32
- CRC-32B
- MD2
- MD4
- MD5
- HAVAL-128,3
- HAVAL-128,4
- HAVAL-128,5
- HAVAL-160,3
- HAVAL-160,4
- HAVAL-160,5
- HAVAL-192,3
- HAVAL-192,4
- HAVAL-192,5
- HAVAL-224,3
- HAVAL-224,4
- HAVAL-224,5
- RIPEMD-128
- RIPEMD-160
- RIPEMD-320
- Tiger-128,3
- Tiger-128,4
- Tiger-160,3
- Tiger-160,4
- Tiger-192,3
- Tiger-192,4
- SHA-1
- SHA-384
- SHA-512
- Whirlpool
Legals
------
- Author : [zessx](https://github.com/zessx)
- Licence : [MIT](http://opensource.org/licenses/MIT)
- Contact : [@zessx](https://twitter.com/zessx)
Donations
---------
[](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KTYWBM9HJMMSE&lc=FR&item_name=Buy%20a%20coffee%20to%20zessx%20%28Samuel%20Marchal%29¤cy_code=EUR&bn=PP%2dDonationsBF%3abmac%3aNonHosted)