# # Adding Gravatars with Perl
APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Adding Gravatars with Perl

I've removed advertising from most of this site and will eventually clean up the few pages where it remains.

While not terribly expensive to maintain, this does cost me something. If I don't get enough donations to cover that expense, I will be shutting the site down in early 2020.

If you found something useful today, please consider a small donation.



Some material is very old and may be incorrect today

© January 2009 Anthony Lawrence

This morning I added Gravatars to the comments here. If you don't have a Gravatar, you can go create one at the Gravatar site.

Adding Gravatars to a site is fairly simple to do - it's just a matter of doing an MD5 hash on the email supplied in the comment form. The Gravatar site has sample code and plugins etc. exist for common platforms.

Your email is never displayed but it might someday be possible to reverse engineer it from the hash (see Wikipedia MD5). If that concerns you, either do not use Gravatars or use an email that doesn't matter for this (see examples in the comments).

The Gravatar site has more explanation in its FAQ


MD5 is plenty good for obfuscating the email address of users across the wire. if you're thinking of rainbow tables, those are all geared at passwords (which are generally shorter, and less globally different from one another) and not email addresses, furthermore they are geared at generating anything that matches the hash, NOT the original data being hashed. If you are thinking about being able to reproduce a collision, you still dont necessarily get the actual email address being hashed from the data generated to create the collision. In either case the work required to both construct and operate such a monstrocity would be prohibitively costly. If we left your password laying around in the open as a plain md5 hash someone might be able to find some data (not necessarily your password) which they could use to log in as you... Leaving your email address out as an md5 hash, however, is not going to cause a violent upsurge in the number of fake rolex watch emails that you get. Lets face it there are far more lucrative, easier, ways of getting email address. I hope this helps ease your mind.

Simple command line code to do this is:

#!/usr/bin/perl
use Digest::MD5  qw(md5_hex);
$data=<>;
chomp $data;
$digest = md5_hex($data);
print " $data = http://www.gravatar.com/avatar.php?gravatar_id=$digest\n";
 

Obviously squeezing that into my comments code took a little more work, but I think it is all set now. Older comments won't show gravatars - only comments you add now that include an email address.


If you found something useful today, please consider a small donation.



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

->
-> Adding Gravatars with Perl

3 comments


Inexpensive and informative Apple related e-books:

Take Control of Parallels Desktop 12

Take Control of Preview

Take Control of Pages

iOS 8: A Take Control Crash Course

iOS 10: A Take Control Crash Course





More Articles by © Anthony Lawrence







Mon Jan 12 15:48:25 2009: 5162   TonyLawrence

gravatar
This is an example using my normal email address.





Mon Jan 12 15:49:10 2009: 5163   TonyLawrence

gravatar
This comment uses a different email address.





Mon Jan 12 15:49:40 2009: 5164   TonyLawrence

gravatar
And this left the email blank

------------------------


Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us


Printer Friendly Version





If you understand something, it is probably already obsolete (James Burke)




Linux posts

Troubleshooting posts


This post tagged:

Blogging

Perl



Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode