From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Computing with big numbers?
Date: Mon, 01 Dec 2008 13:52:54 +0100 [thread overview]
Message-ID: <4933DE26.2030705@ens-lyon.org> (raw)
In-Reply-To: <1A5BFA46-376C-41BB-B357-8A7899C600C6@polytechnique.org>
Alan Schmitt wrote:
> 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?
If I understand your problem correctly, this is the so-called birthday
problem with 2^128 days in a year. The Wikipedia article gives useful
approximations:
http://en.wikipedia.org/wiki/Birthday_problem
Martin
--
http://mjambon.com/
next prev parent reply other threads:[~2008-12-01 12:53 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-01 12:36 Alan Schmitt
2008-12-01 12:52 ` Martin Jambon [this message]
2008-12-01 14:29 ` [Caml-list] " 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4933DE26.2030705@ens-lyon.org \
--to=martin.jambon@ens-lyon.org \
--cc=alan.schmitt@polytechnique.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox