From owner-freebsd-questions Mon Oct 7 21:30:30 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DC2FE37B401 for ; Mon, 7 Oct 2002 21:30:28 -0700 (PDT) Received: from russian-caravan.cloud9.net (russian-caravan.cloud9.net [168.100.1.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A2F343EB1 for ; Mon, 7 Oct 2002 21:30:28 -0700 (PDT) (envelope-from Hostmaster@Video2Video.Com) Received: from earl-grey.cloud9.net (earl-grey.cloud9.net [168.100.1.1]) by russian-caravan.cloud9.net (Postfix) with ESMTP id BAC3D28E99 for ; Tue, 8 Oct 2002 00:30:27 -0400 (EDT) Date: Tue, 8 Oct 2002 00:30:27 -0400 (EDT) From: Peter Leftwich X-X-Sender: To: FreeBSD LIST Subject: Re: /dev/urandom is randomly cool In-Reply-To: <200210062207.g96M7NgO056867@lurza.secnetix.de> Message-ID: <20021008002612.C35848-100000@earl-grey.cloud9.net> Organization: Video2Video Services - http://Www.Video2Video.Com MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 7 Oct 2002, Oliver Fromme wrote: > Peter Leftwich wrote: > > On Sun, 6 Oct 2002, Fernando Gleiser wrote: > > > On Sun, 6 Oct 2002, Mikko Ty=F6l=E4j=E4rvi wrote: > > > > tr -cd a-zA-Z0-9 < /dev/urandom | dd bs=3D$len count=3D1 2>/dev/n= ull > > It didn't work. My shell is tcsh so I tried: > > tr -cd a-zA-Z0-9 < /dev/urandom | dd bs=3D8 count=3D1 >& /dev/null > > And all I got was the next prompt. > Yep, csh and tcsh suck pretty much. Not being able to separately > redirect stderr easily is one of the reasons. Bizarre. From now on I'll have to insert `bash ; ` before commands :) > In this particular case, you can use head instead of dd: > tr -cd a-zA-Z0-9 < /dev/urandom | head -c 8 Thanks for that! I was trying `cut -c` and didn't realize head had that flag. Now I can generate 8 characters: # tr -cd a-zA-Z0-9 < /dev/urandom | head -c 8 ; echo "" 0tXx3p3m =2E..and random phone numbers :) # tr -cd 0-9 < /dev/urandom | head -c 10 ; echo "" 5031594488 > If your intention is to generate passwords, then you should also include = special characters, not just letters and digits. I once wrote a small shel= l script to generate good passwords: > http://www.secnetix.de/~olli/scripts/genpwd Nope. > After installing it somwhere in yout $PATH (for example in > /usr/local/bin) and making it executable, type "genpwd -h" Do any other flavors of unix come with password generators? > for usage information. It also uses /dev/urandom, if it > exists, but it also works fine without -- you can easily > remove that part from the script (three lines) and it will > still work with sufficient randomness, without having to > touch your kernel's entropy pool. Why is this an entropy pool and not an entropy ocean? Is there a way to cat /dev/dsp or analyze my soundcard's mic-in and sample randomness? > BTW, the script can also be (ab)used for other things. > There are two examples in the usage message. > Regards > Oliver > Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 M=FCnchen > "All that we see or seem is just a dream within a dream" (E. A. Poe) Thanks again Oliver. -- Peter Leftwich President & Founder Video2Video Services Box 13692, La Jolla, CA, 92039 USA +1-413-403-9555 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message