Re: MD5 hash query

From: Joe Cooper <>
Date: Fri, 28 Dec 2001 14:17:02 -0600

Henrik Nordstrom wrote:

> On Friday 28 December 2001 12.23, Robert Collins wrote:
>>from a quick eyeball, you need to feed id, method (An ENUM value) and
>>then the URL.
>>(unsigned char *) &id, sizeof(id));
>>(unsigned char *) &method, sizeof(method));
>>(unsigned char *) url, strlen(url));
>>So there are unique for a given version of squid (id and method will
>>change), and potentially even for different C compilers or platforms.
> id is only in private temporary keys.
> method is the method enum converted into a single char.
> perl, simplified for GET (enum 1) only:
> #!/usr/bin/perl -w
> use Digest::MD5 qw(md5_hex);
> print uc(md5_hex("\1", $ARGV[0])),"\n";

Henrik, you're my hero!

That did the trick right nicely. Now I can get onto the fun stuff
(database construction). Robert you were right as well, I was just too
tired to notice (you suggested '\1'...I was thinking I had to translate
that into a 'real' binary representation--see what sleep deprivation can
do to you?).

Thanks guys.

Joe Cooper <>
Web Caching Appliances and Support
Received on Fri Dec 28 2001 - 13:15:34 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:42 MST