Skip to content

Identitiles is yet another identicon variant. Generate random avatar in canvas based on MD5 hash (ex. IP address)

Notifications You must be signed in to change notification settings

ivebe/identitiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Ivebe/Identitiles

Identitiles is yet another identicon variant. For those who don't know, here is short description what identicon is:

An Identicon is a visual representation of a hash value, usually of an IP address, that serves to identify a user of a computer system as a form of avatar while protecting the users privacy.

Why would I use it?

Identicons are widely used as a avatars that need to visually identify users which do not have personal avatar set. Something like the following sample for user comments.

comment sample

How does it work?

Identitiles use 32 characters MD5 hash to draw a 3x3 unique square. It's a simple JS library that will draw on a canvas, so no actual image will be stored on disk. Logic behind this is that we add one additional character to the MD5 hash so that we have 33 characters in total. First square use first 6 characters for its color. Next 7 squares will use 3 characters color, and last square will use 6 characters color. Since color can only be represented as 3 or 6 characters, we needed to add extra character (F) to the total 32 of MD5 hash.

Usage

Pass MD5 hash into function which can be hash of IP address, email, username, or anything else that comes to your mind.

<canvas id="canvas" width="90" height="90"></canvas>

<script src="identitiles.js"></script>
<script>
    identitiles('canvas', '356ac8f205de4837377957243a5ed469');
</script>

About

Identitiles is yet another identicon variant. Generate random avatar in canvas based on MD5 hash (ex. IP address)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •