Search code examples
phpalgorithmidenticon

Generating a custom Identicon avatar?


So I know about Identicons, MonsterID's, and Wavatars, etc, and understand that they use hashed IP addresses/e-mails to generate a unique avatar.

Is there any information about the algorithm so that I can create my own set? I'd like to do this in PHP.


Solution

  • If 'ABCDEFGH' is the 32 bit hash of email id in hex format, you can use 'A' to pick the monster, 'B' to pick the eye color and so on.

    Note that each letter here can have 16 different values. So you can choose 16 different values for each attribute. If you have more values use a longer selection of bits.

    See https://www.php.net/hash for more information about calculating hashes in php.