Re: MD5 risks?

1999-11-14 Thread Stephen Zander

> "Trevor" == Trevor Phillips <[EMAIL PROTECTED]> writes:
Trevor> Another alternative is to get the MD5 base64 key to the
Trevor> URI. My query is, what is the chance of two URI's giving
Trevor> the same MD5? Is there any risk in it, or is MD5 guranteed
Trevor> to give unique ID's? (I know the risk would be SLIM, but
Trevor> how slim?) Is MD5 used regularly for this kind of thing?

What you're asking about is the likelihood of a 'birthday attack' on a
given hash.  Quoting Bruce Schneier's 'Applied Cryptography', 2nd
ed. p166:

  Finding two [m-bit] message that hash to the same value would only
  require 2**(m/2) messages This means that if you're worried
  about a birthday attack, you should use a hash value twice as long
  as you otherwise might think you need.  For example, if you want to
  drop the odds of someone breaking into your system to less than 1 in
  2**80, use a 160-bit one-way hash function.

So, with MD5 you have a 1 in 2**64 chance of getting a collision
between two URLs.  Adding the lenght of the URL doesn't make any
practical difference as that's already done as part of the hashing
algorithm.

BTW, if you plan dealing with any cryptographic-related functions,
Schneier's book is a must: ISBN 0-471-12845-7

-- 
Stephen

"If I claimed I was emporer just cause some moistened bint lobbed a
scimitar at me they'd put me away"



Re: MD5 risks?

1999-11-10 Thread Mike Fletcher

> "Ken" == Ken Williams <[EMAIL PROTECTED]> writes:

Ken> As with any hashing algorithm, you need to deal with
Ken> collisions.  The chances of having two URIs with the same MD5
Ken> are slim, but definitely nonzero.  Apply the pigeonhole
Ken> principle.

Ken> MD5 is pretty commonly used for this kind of thing, but in my
Ken> opinion it shouldn't be unless you're prepared to deal with
Ken> collisions.  It seems like there's nothing wrong with your
Ken> plan of translating to FFCs, except that the names will be
Ken> long - but who cares?

Seeing as how MD5 generates a 128-bit checksum your chances of 
collision are *reaaallly* slim.  If you're that paranoid about the
possibilities, use Digest::SHA1 which produces a 160-bit checksum.

-- 
Fletch| "If you find my answers frightening,   __`'/|
[EMAIL PROTECTED]   |  Vincent, you should cease askin'  \ o.O'
678 443-6239(w)   |  scary questions." -- Jules=(___)=
  |   U



Re: MD5 risks?

1999-11-09 Thread Gisle Aas

Ben Bell <[EMAIL PROTECTED]> writes:

> On Tue, Nov 09, 1999 at 10:24:39AM +0800, Trevor Phillips wrote:
> > Another alternative is to get the MD5 base64 key to the URI. My query is, what
> > is the chance of two URI's giving the same MD5? Is there any risk in it, or is
> > MD5 guranteed to give unique ID's? (I know the risk would be SLIM, but how
> > slim?) Is MD5 used regularly for this kind of thing?
> Very slim :) something like 1/1000 billion, billion, billion, billion.
> for a match to a particular key, though about 1/1 billion billion for
> getting a collision in general. (In the region of 1 / (2^128) and 1 / (2^64)
> respectively.
>
> If you tack on the length of the string your MD5ing as well then you're
> pretty much safe.

I don't think this buy you much extra safety.  The length of URIs
don't vary significantly compared to MD5.

-- 
Gisle Aas



Re: MD5 risks?

1999-11-09 Thread Ben Bell

On Tue, Nov 09, 1999 at 10:24:39AM +0800, Trevor Phillips wrote:
> Another alternative is to get the MD5 base64 key to the URI. My query is, what
> is the chance of two URI's giving the same MD5? Is there any risk in it, or is
> MD5 guranteed to give unique ID's? (I know the risk would be SLIM, but how
> slim?) Is MD5 used regularly for this kind of thing?
Very slim :) something like 1/1000 billion, billion, billion, billion.
for a match to a particular key, though about 1/1 billion billion for
getting a collision in general. (In the region of 1 / (2^128) and 1 / (2^64)
respectively.
If you tack on the length of the string your MD5ing as well then you're
pretty much safe.
This is sufficiently small that IIRC you'll have to start taking into
consideration the chances of your computer's memory spontaneously
corrupting.

Cheers,
Ben

-- 
+-Ben Bell - "A song, a perl script and the occasional silly sig.-+
  ///  email: [EMAIL PROTECTED]www: http://www.deus.net/~bjb/
  bjbDon't try to drive me crazy... 
  \_/...I'm close enough to walk. 



Re: MD5 risks?

1999-11-08 Thread Ken Williams

As with any hashing algorithm, you need to deal with collisions.  The chances
of having two URIs with the same MD5 are slim, but definitely nonzero.  Apply
the pigeonhole principle.

MD5 is pretty commonly used for this kind of thing, but in my opinion it
shouldn't be unless you're prepared to deal with collisions.  It seems like
there's nothing wrong with your plan of translating to FFCs, except that the
names will be long - but who cares?


[EMAIL PROTECTED] (Trevor Phillips) wrote:
>I'm writing a module, where I want to store info on a per URI basis. For
>reasons I won't go into here, I'm storing info in a file per URI. At the
>moment, I'm tweaking the URI into Filesystem friendly characters, and calling
>the file that.
>
>Another alternative is to get the MD5 base64 key to the URI. My query is, what
>is the chance of two URI's giving the same MD5? Is there any risk in it, or is
>MD5 guranteed to give unique ID's? (I know the risk would be SLIM, but how
>slim?) Is MD5 used regularly for this kind of thing?
>
>(MD5 newbie...)
>
>-- 
>.. Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
>: CWIS Technical Officer -   [EMAIL PROTECTED] : 
>| IT Services   -   Murdoch University | 
> >--- Member of the #SAS# & #CFC# <
>| On nights such as this, evil deeds are done. And good deeds, of /
>| course. But mostly evil, on the whole. /
> \  -- (Terry Pratchett, Wyrd Sisters)  /
>

  ------
  Ken Williams Last Bastion of Euclidity
  [EMAIL PROTECTED]The Math Forum




MD5 risks?

1999-11-08 Thread Trevor Phillips

I'm writing a module, where I want to store info on a per URI basis. For
reasons I won't go into here, I'm storing info in a file per URI. At the
moment, I'm tweaking the URI into Filesystem friendly characters, and calling
the file that.

Another alternative is to get the MD5 base64 key to the URI. My query is, what
is the chance of two URI's giving the same MD5? Is there any risk in it, or is
MD5 guranteed to give unique ID's? (I know the risk would be SLIM, but how
slim?) Is MD5 used regularly for this kind of thing?

(MD5 newbie...)

-- 
. Trevor Phillips -   http://jurai.murdoch.edu.au/ . 
: CWIS Technical Officer -   [EMAIL PROTECTED] : 
| IT Services   -   Murdoch University | 
 >--- Member of the #SAS# & #CFC# <
| On nights such as this, evil deeds are done. And good deeds, of /
| course. But mostly evil, on the whole. /
 \  -- (Terry Pratchett, Wyrd Sisters)  /