Easy To Deploy Identicon Handler

Yesterday I mentioned that Jeff Atwood and Jon Galloway wrote an Identicon implementation for .NET. It works beautifully, but they distributed the code as a Web Site Project, which I cannot deploy to my blog as is.

For those of us who prefer Web Application projects, I repackaged their code as compiled DLL and a handler file. This distribution will work for both Web Application Projects as well as Website Projects.

Just download the binaries, copy the DLL to your bin directory, copy the IdenticonHandler.ashx file to your website directory, and you are good to go. You can simply add an image tag that references your identicon handler.

<img src="IdenticonHandler.ashx?hash=hash-of-ip-address" />

[Download Binaries]

You can also grab the Solution I used to prepare the binaries.

[Download Source]

Gravatar Tip!

If you use Gravatar, consider using the identicon handler as the default image. That’s what I did for this website. That way, if the user does not have a gravatar, the identicon will show up instead. Better than nothing!

What others have said

Requesting Gravatar... Jeff Atwood Jan 22, 2007 9:46 AM
# re: Easy To Deploy Identicon Handler
Does it work? It doesn't show a preview of the Identicon :(

This is a test comment
Requesting Gravatar... Jon Galloway Jan 22, 2007 10:34 AM
# re: Easy To Deploy Identicon Handler
I can't wait to see my identicon!
Requesting Gravatar... Jeff Atwood Jan 22, 2007 10:52 AM
# re: Easy To Deploy Identicon Handler
We gotta get rid of that sub background, it really doesn't work with the Identicon overlaid. IMHO.
Requesting Gravatar... Haacked Jan 22, 2007 11:15 AM
# re: Easy To Deploy Identicon Handler
Jeff, you probably have my stylesheet cached. Hit CTRL+F5.
Requesting Gravatar... matt Jan 22, 2007 11:23 AM
# re: Easy To Deploy Identicon Handler
my identicon?
Requesting Gravatar... Daruku Jan 22, 2007 12:27 PM
# re: Easy To Deploy Identicon Handler
Do I have an identicon?
Requesting Gravatar... Jeff Atwood Jan 22, 2007 12:44 PM
# re: Easy To Deploy Identicon Handler
The identicon really needs to be part of "Live Comment Preview", below ;)
Requesting Gravatar... Haacked Jan 22, 2007 1:08 PM
# re: Easy To Deploy Identicon Handler
Yeah, I know. But I don't have the time for all that right now. This was a spur of the moment "Hack" job.
Requesting Gravatar... chadly Jan 22, 2007 1:36 PM
# re: Easy To Deploy Identicon Handler
one for me too?
Requesting Gravatar... Daruku Jan 22, 2007 2:16 PM
# re: Easy To Deploy Identicon Handler
Do I still have the same identicon?
Requesting Gravatar... Dan Jan 22, 2007 2:30 PM
# re: Easy To Deploy Identicon Handler
just want to see my gravatar
Requesting Gravatar... Jeremy Jan 22, 2007 3:16 PM
# re: Easy To Deploy Identicon Handler
Can't wait to see what mine is... it's like opening a Christmas present.
Requesting Gravatar... Scott Hanselman Jan 22, 2007 3:44 PM
# re: Easy To Deploy Identicon Handler
Very exciting!
Requesting Gravatar... Scott Hanselman Jan 22, 2007 3:55 PM
# re: Easy To Deploy Identicon Handler
Hm...my IP hasn't changed, why is my icon different HERE than at Don's?
Requesting Gravatar... Haacked Jan 22, 2007 4:08 PM
# re: Easy To Deploy Identicon Handler
I'm using a different salt value. It's not a straight hash of your IP. There's a bit of salt thrown in. So it'll only be consistent on my blog.
Requesting Gravatar... Keyvan Nayyeri Jan 22, 2007 8:28 PM
# re: Easy To Deploy Identicon Handler
Very nice :-)
Requesting Gravatar... Don Park Jan 22, 2007 11:12 PM
# re: Easy To Deploy Identicon Handler
Identicons being site-specific enhance privacy, meaning that no one can notice that a comment at a porn torrent forum and a comment here was posted by the same person. ;-)
Requesting Gravatar... F'yth Jan 23, 2007 3:56 AM
# re: Easy To Deploy Identicon Handler
Well my identicon was pink over at Don's.. I wonder what it looks like here. ;D
Requesting Gravatar... Haacked Jan 23, 2007 8:36 AM
# re: Easy To Deploy Identicon Handler
Oh good, then I'm free to post on my porn message boards again. ;)
Requesting Gravatar... Jon Galloway Jan 24, 2007 12:02 AM
# Identicons - Ported from Java Servlet to HttpHandler
Summary Identicons provide a nice visual indicator that's unique to each user on a website. It's unique
Requesting Gravatar... Jan Bannister Jan 24, 2007 2:53 AM
# re: Easy To Deploy Identicon Handler
These are really cool
Requesting Gravatar... jayson knight Jan 24, 2007 3:13 AM
# re: Easy To Deploy Identicon Handler
Shall be implementing this on CS very soon...nice work.
Requesting Gravatar... Luke Jan 24, 2007 4:53 AM
# re: Easy To Deploy Identicon Handler
And mine looks like?
Requesting Gravatar... Asif Raza Jan 24, 2007 4:55 AM
# re: Easy To Deploy Identicon Handler
what will mine look likes
Requesting Gravatar... matt Jan 24, 2007 7:34 AM
# re: Easy To Deploy Identicon Handler
i'm back! i'm addicted to my identicon. what a novel idea.
Requesting Gravatar... Adam Jan 24, 2007 9:03 AM
# re: Easy To Deploy Identicon Handler
Gotta see it
Requesting Gravatar... Jackal Jan 24, 2007 10:04 AM
# re: Easy To Deploy Identicon Handler
Gotta See one.

Thanks for porting this
Requesting Gravatar... pieter Jan 24, 2007 11:53 AM
# re: Easy To Deploy Identicon Handler
please show me mine. ;)
Requesting Gravatar... Jon Jan 24, 2007 2:00 PM
# re: Easy To Deploy Identicon Handler
What does mine look like?
Requesting Gravatar... rachel Jan 24, 2007 2:04 PM
# re: Easy To Deploy Identicon Handler
this is neat!
Requesting Gravatar... Bruce Jan 24, 2007 2:51 PM
# re: Easy To Deploy Identicon Handler
I can't help myself, I just have to see.
Requesting Gravatar... Ben Hyrman Jan 24, 2007 10:18 PM
# re: Easy To Deploy Identicon Handler
You're a life-saver. I wanted a fairly anonymous way to show the last five authors on my site and this fits that bill perfectly. Excellent examples the other day on what an identicon was and great followup today with the handler port.

I've implemented identicons at AintMySite.com, a site that anyone can edit at any time as they see fit (as a result, warning, may or may not be work safe). I think it's a perfect solution for my needs.
Requesting Gravatar... Ricardo Peres Jan 25, 2007 4:53 AM
# re: Easy To Deploy Identicon Handler
Just testing...
Requesting Gravatar... jayson knight Jan 25, 2007 8:51 PM
# re: Easy To Deploy Identicon Handler
Having some issues with the "Easy to Deploy" part. Gimme a shout or I can give details in this thread.
Requesting Gravatar... Jeff Atwood Jan 26, 2007 4:10 PM
# re: Easy To Deploy Identicon Handler
We said EASY TO DEPLOY! Does it help if we say it louder? ;)
Requesting Gravatar... jayson knight Jan 27, 2007 1:22 AM
# re: Easy To Deploy Identicon Handler
Yup, it's perfectly clear now, volume always helps ;-).

"hash=hash-of-ip-address"

What hash is it looking for? I've tried using the Code member in the Util class to hash the IP, I've tried a hashcode, which doesn't work b/c the IP is rehashed in the handler. Red X's abound, and the resulting hash looks way off.

As is usually the case with me, I'm sure I'm overlooking something glaringly obvious and simple.
Requesting Gravatar... Haacked Jan 27, 2007 1:25 AM
# re: Easy To Deploy Identicon Handler
The "hash" query string parameter ought to be a salted hash of the IP Address. When testing, cut and paste the URL into your address bar to see what error messages occur.

Make sure you don't have some sort of rewriting rule intercepting the request to the ashx page.
Requesting Gravatar... Jason Haley Jan 27, 2007 8:21 AM
# Interesting Finds: January 27, 2007
Requesting Gravatar... Ayende Rahien Jan 27, 2007 11:40 AM
# re: Easy To Deploy Identicon Handler
What about mine?
Requesting Gravatar... Tada Feb 04, 2007 11:30 AM
# re: Easy To Deploy Identicon Handler
So this is not useless how?
Requesting Gravatar... Simone Chiaretta Feb 05, 2007 3:54 AM
# re: Easy To Deploy Identicon Handler
Let's see mine
Requesting Gravatar... Simone Feb 05, 2007 7:56 PM
# re: Easy To Deploy Identicon Handler
Trying without specifying email :)
Requesting Gravatar... Vittorio Feb 08, 2007 6:50 AM
# re: Easy To Deploy Identicon Handler
my gravatar please :O
Requesting Gravatar... Dan Jul 12, 2007 3:49 PM
# re: Easy To Deploy Identicon Handler
I'll check into the identicon bit- thanks for the tip.

*testing my gravatar*
Requesting Gravatar... Qwaider قويدر Oct 17, 2007 10:52 AM
# re: Easy To Deploy Identicon Handler
Hi there,
I loved the idea, but decided to implement it for Email addresses instead of IP addresses. And the result was STUNNING!(seriously!)
So now, instead of Gravatar (which is based on Email) I use Gravatar and the default picture is an Identicon. Best part is. Once the identicon is created, I cache it so I don't have to create it once more :)


Thank you that was very helpful
Requesting Gravatar... Johan Jan 24, 2008 1:18 AM
# re: Easy To Deploy Identicon Handler
Cool! I thought i'd have to compile this to a dll myself, but this is much simpler. Big thanks!

(also testing my identicon :)
Requesting Gravatar... Henry Jun 18, 2008 10:11 PM
# re: Easy To Deploy Identicon Handler
Thank you that was very helpful
Requesting Gravatar... togi Jul 11, 2008 1:37 PM
# re: Easy To Deploy Identicon Handler
Neat! I suppose i need to put in a comment here, just to get a identicon :D

What do you have to say?

(will show your gravatar)
Please add 2 and 4 and type the answer here: