From owner-freebsd-current Sun Feb 2 10:41:59 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 BBFA037B401 for ; Sun, 2 Feb 2003 10:41:57 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id D743243F79 for ; Sun, 2 Feb 2003 10:41:56 -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 h12IfsLf078695; Sun, 2 Feb 2003 18:41: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 h12IfsSt078694; Sun, 2 Feb 2003 18:41: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 h12Ia2aX049696; Sun, 2 Feb 2003 20:36:03 +0200 (SAST) (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200302021836.h12Ia2aX049696@grimreaper.grondar.org> To: "Andrey A. Chernov" Cc: current@FreeBSD.ORG Subject: Re: rand() is broken In-Reply-To: Your message of "Sun, 02 Feb 2003 21:20:09 +0300." <20030202182009.GA66318@nagual.pp.ru> Date: Sun, 02 Feb 2003 18:36:02 +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 17:30:48 +0000, Mark Murray wrote: > > > > Why not? Arc4 is a) deterministic and b) good for all bits. > > If you mean arc4random() function - not, because it use true randomness, > if you mean RC4 algorithm, probably yes, but we should compare its > distribution with our current variant and be sure that speed is > acceptable. What form RC4 distribution have? (I have read the whole thread) I think we need four things. 1) void srandom(int arg) which uses the argument to seed. 2) void srandomdev(void) which uses system entropy to seed. 3) int random(void) which returns a number statistically random in all bits. 4) which returns as many bytes of randomness (statistically random in all bits) as the caller asks for. We have most of this, and RC4 can deliver. RC4's "licence" is fine. Call it "ArCFour" and there is no problem. The code is small, fast and repeatable, and meets conditions 1-4 above. Coding is Junior-high-school level, given the spec. 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