caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Computing with big numbers?
@ 2008-12-01 12:36 Alan Schmitt
  2008-12-01 12:52 ` [Caml-list] " Martin Jambon
  2008-12-01 13:47 ` Dario Teixeira
  0 siblings, 2 replies; 9+ messages in thread
From: Alan Schmitt @ 2008-12-01 12:36 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 1083 bytes --]

Hello,

In preparation for a talk I'm going to give, I wanted to estimate how  
good 128 bits MD5 hashes were: how many hashes must be taken before  
the probability for a collision become non negligible? (I'm assuming  
equi-probability of every hash.)

The brute force approach is simply to enumerate the non-collision  
probability for k different hashes, and compute until it becomes lower  
than 1. This probability is (writing N for 2 ^ 128):
N * (N-1) * (N - 2) * ... * (N - k)
---------------------------------------
N^k

I tried computing this using the bignum library that comes with OCaml,  
and it slows down to a crawl very fast (for k ~ 1000).

So I tried to be more subtle and approximate the result (using  
Stirling's approximation of factorials), but OCaml's floats are not  
precise enough to yield anything significant. (I'm trying to compute  
the log of the approximation of N! / (N^k * (N-k)!), which is N (ln N)  
- N - (k (ln N) + (N - k)(ln (N - k)) - (N - k)).)

Is there a library with better floating point precision than the OCaml  
one?

Thanks,

Alan

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-12-05  7:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-01 12:36 Computing with big numbers? Alan Schmitt
2008-12-01 12:52 ` [Caml-list] " Martin Jambon
2008-12-01 14:29   ` Alan Schmitt
2008-12-01 13:47 ` Dario Teixeira
2008-12-01 14:37   ` Alan Schmitt
2008-12-04 16:06     ` Florian Hars
2008-12-04 16:40       ` David Thomas
2008-12-04 21:51       ` Martin Jambon
2008-12-05  7:07       ` Alan Schmitt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).