I've been given the task to implement Identicon
using Delphi. I have searched the internet and still did not find anything.
so where do I begin, is there someone here who can give an explanation?

- 12,111
- 21
- 91
- 136

- 19
- 1
-
http://blog.stackoverflow.com/2008/06/gravatars-identicons-and-you/ – David Heffernan Jan 24 '14 at 08:05
-
1There are many many pages discussing them if you do a websearch. Something tells me that what you really want is some code. – David Heffernan Jan 24 '14 at 08:06
-
And LURD's link to the wikipedia page contains links to source code. It really looks to me like you should try harder. – David Heffernan Jan 24 '14 at 09:43
-
@David Heffernan: Well of course I've visited that link before. but there's none of samples code from Delphi. I need a more detailed explanation. My plan is to create routine to generate identicon. – hnd.kustiawan Jan 27 '14 at 07:56
-
In other words you were asking for code. You should have said so. – David Heffernan Jan 27 '14 at 08:08
2 Answers
This is just an explanation to give you the idea of the Identicons.
Identicons are graphical representations of a bunch of bytes most likely a hash value.
Lets take a sample MD5 hash value (16 bytes)
abf5787309f3c4d5b255237c0b67dd5e
Ok let them arrange in a different way
ab f5 78 73 09 f3 c4 d5 b2 55 23 7c 0b 67 dd 5e
Now we have 16 fields each representing a byte. So we could build an image with 256 different small images. But maybe we can break it down to a less complicated method.
Lets take one byte (the first one ab) and its binary representation
10101011
Ok, let them arrange in a different way :o)
10 10 10 11
Now we have 4 fields and each field can have one of four states. And that is very easy to manage 4 different images.
00 = empty 01 = / 10 = \ 11 = X
Back to our byte we will get this
┌─────┐ │ \ \ │ │ \ X │ └─────┘
And back to the whole we get
┌─────┬─────┬─────┬─────┐ │ \ \ │ X X │ / X │ / X │ │ \ X │ / / │ \ │ X │ ├─────┼─────┼─────┼─────┤ │ │ X │ X │ X / │ │ \ / │ X │ / │ / / │ ├─────┼─────┼─────┼─────┤ │ \ X │ / / │ \ │ / X │ │ \ │ / / │ X │ X │ ├─────┼─────┼─────┼─────┤ │ │ / \ │ X / │ / / │ │ \ X │ / X │ X / │ X \ │ └─────┴─────┴─────┴─────┘
The whole point here is reduction into easy to handle small parts.
I once started to port the original library to Delphi / Graphics32. However, I never found the time to finish the small project until now. The source code together with a sample application can be found on my website (see Delphi -> Graphics32).
Originally it was meant to show some new vector graphic features from the upcoming version 2.0. Despite the fact, that this has still not been released, the source code can already be compiled with the code in the trunk repository.

- 1,783
- 1
- 24
- 28