From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q01HTGjY009171 for ; Sun, 1 Jan 2012 18:29:16 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiMFAMSWAE/UGyoClGdsb2JhbABDggWoGYI3IgEBAQEJCyYDIoFyAQEFUyURCxgJFg8JAwIBAgFFEwgBAYd4s3aIdYMaBJUChU+MZg X-IronPort-AV: E=Sophos;i="4.71,441,1320620400"; d="scan'208";a="125210077" Received: from smtp2-g21.free.fr ([212.27.42.2]) by mail4-smtp-sop.national.inria.fr with ESMTP; 01 Jan 2012 18:29:10 +0100 Received: from [192.168.1.3] (unknown [82.237.71.191]) by smtp2-g21.free.fr (Postfix) with ESMTP id AAF904B008C for ; Sun, 1 Jan 2012 18:29:03 +0100 (CET) Message-ID: <4F0097E6.2090701@inria.fr> Date: Sun, 01 Jan 2012 18:29:10 +0100 From: Xavier Leroy User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110921 Thunderbird/3.1.15 MIME-Version: 1.0 To: caml-list@inria.fr References: <1325263446.5036.104.camel@samsung> <4EFDEF92.3010204@inria.fr> <20120101125212.GB12851@annexia.org> In-Reply-To: <20120101125212.GB12851@annexia.org> X-Enigmail-Version: 1.1.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Caml-list] Hashtbl and security On 01/01/2012 01:52 PM, Richard W.M. Jones wrote: > On Fri, Dec 30, 2011 at 06:06:26PM +0100, Xavier Leroy wrote: >> Indeed. The optional "seed" parameter to Hashtbl.create does exactly >> this in the new implementation of Hashtbl (the one based on Murmur3). > > It may be worth noting that Perl solved this problem (back in 2003) by > unconditionally using a seed which is a global set to a random number > during interpreter initialization. That's how my initial reimplementation of Hashtbl worked, using the Random module to produce seeds, but I was told (correctly) that in security-sensitive applications it's better to leave the generation of random numbers under control of the programmer. For some applications Random.self_init might be good enough and for others stronger randomness is needed. Of course, you can trivially emulate Perl's behavior using the new Hashtbl implementation + the Random module. - Xavier Leroy