An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

![HashIcon](HashIcon.png)
========

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
```

![HashIcon example](sample.png)

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

[![Buy me a coffee !](http://doc.smarchal.com/bmac)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=KTYWBM9HJMMSE&lc=FR&item_name=Buy%20a%20coffee%20to%20zessx%20%28Samuel%20Marchal%29&currency_code=EUR&bn=PP%2dDonationsBF%3abmac%3aNonHosted)