From owner-freebsd-current Sun Feb 2 14:21:57 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 001F437B401 for ; Sun, 2 Feb 2003 14:21:55 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1645B43F93 for ; Sun, 2 Feb 2003 14:21:55 -0800 (PST) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) by storm.FreeBSD.org.uk (8.12.6/8.12.6) with ESMTP id h12MLsLf080807; Sun, 2 Feb 2003 22:21:54 GMT (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost) by storm.FreeBSD.org.uk (8.12.6/8.12.6/Submit) with UUCP id h12MLs9Y080806; Sun, 2 Feb 2003 22:21:54 GMT X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1]) by grimreaper.grondar.org (8.12.6/8.12.6) with ESMTP id h12MJYaX052408; Mon, 3 Feb 2003 00:19:34 +0200 (SAST) (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200302022219.h12MJYaX052408@grimreaper.grondar.org> To: "Andrey A. Chernov" Cc: current@FreeBSD.ORG Subject: Re: rand() is broken In-Reply-To: Your message of "Mon, 03 Feb 2003 01:01:28 +0300." <20030202220128.GC68356@nagual.pp.ru> Date: Sun, 02 Feb 2003 22:19:33 +0000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG "Andrey A. Chernov" writes: > On Sun, Feb 02, 2003 at 21:23:43 +0000, Mark Murray wrote: > > > > That was random(9). KERNEL random(). > > KERNEL random() can be easily implemented (better - replaced) with > arc4random(), there is no objections. But... > > 1) Implementing random(3) with RC4 is not needed, its algorithm is > already equal or better. Rubbish. :-) RC4's internal state is 256 bytes. In theory, its cycle-of-repetition is 2^(8*256) bits. The current library PRNGs are quite a bit less than that. > 2) Implementing rand(3) with RC4 can be possible only if seed (i.e. > state) can be stored in single word (due to rand_r()) restrictions. This is true. Sort of. But in this case, things get less easy. Hmm. I need to look at this some more. Thanks! M M -- Mark Murray iumop ap!sdn w,I idlaH To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message