Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Compact MD5 representation

by Anonymous Monk
on Mar 20, 2001 at 03:29 UTC ( [id://65578]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Compact MD5 representation
in thread Compact MD5 representation

I'm a php person, so I can't offer code, but I do understand the question which is being asked.

Rather than showing a url of /?a=123456, the questioner is looking for a url that says /?a=rqz instead. By using the full range of alphanumeric characters, he is hoping to reduce the MD5 from a 32 character string (using 0-9,a-f), into something much smaller, maybe a 12 character string (using 0-9, a-z). This has the benefit of being shorter, while still spanning the same range of values (2^32) as MD5.

php has the function: string base_convert (string number, int frombase, int tobase), which I'm sure has an equivalent in perl. Once you find this function the problem is reduced to:

$new_number = base_convert( md5('whatever'), 16, 36 ); // 10 digits + 26 alphanumeric

Hopefully some perl guru will be able to point you in the right direction.

--Robert

Replies are listed 'Best First'.
Re: Re: Re: Re: Compact MD5 representation
by merlyn (Sage) on Mar 20, 2001 at 04:03 UTC
    That's sorta what was already being gotten at by using the _base64 version rather than the _hex version. Read the other responses in this thread.

    -- Randal L. Schwartz, Perl hacker

Re^4: Compact MD5 representation
by Anonymous Monk on Sep 10, 2004 at 22:28 UTC
    and mysql has it just as easy: "SELECT CONV(md5, 16, 36) from table"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://65578]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-19 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found