From owner-freebsd-questions Tue Dec 21 6:12:19 1999 Delivered-To: freebsd-questions@freebsd.org Received: from athserv.otenet.gr (athserv.otenet.gr [195.170.0.1]) by hub.freebsd.org (Postfix) with ESMTP id 7497814DB3 for ; Tue, 21 Dec 1999 06:12:15 -0800 (PST) (envelope-from keramida@diogenis.ceid.upatras.gr) Received: from localhost.hell.gr (patr530-a095.otenet.gr [195.167.115.95]) by athserv.otenet.gr (8.9.3/8.9.3) with SMTP id QAA18307 for ; Tue, 21 Dec 1999 16:12:21 +0200 (EET) Received: (qmail 5669 invoked by uid 1001); 21 Dec 1999 13:09:17 -0000 Date: Tue, 21 Dec 1999 15:09:17 +0200 From: Giorgos Keramidas To: Fabrizzio Batista Cc: freebsd-questions@freebsd.org Subject: Re: SALT Algorithm in PERL Message-ID: <19991221150917.F728@hades.hell.gr> Reply-To: keramida@ceid.upatras.gr References: <000601bf4ae3$0ac55780$65010180@lojasobino.com.br> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-7 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0pre3i In-Reply-To: <000601bf4ae3$0ac55780$65010180@lojasobino.com.br> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Dec 20, 1999 at 10:09:17AM -0200, Fabrizzio Batista wrote: | | Hi gurus, | | I am using a FreeBSD box (3.3 S) in a ISP, and I need to make a | script that change the users passwords. I am using the PERL language | to make this, but I donīt have the SALT Algorithm. If I recall this correctly, you can use a random pair of characters from the [a-zA-Z0-9./] character class. Given a routine in perl that returns a random integer between 0..63 (i.e. one called &rand64), you can use: # excuse the too long line here ;) $universe = "./0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; $s0 = $universe[&rand64]; $s1 = $universe{&rand64]; $salt = "$s0$s1"; or something similar to this one, my perl is not that good, and I might have made some silly mistake. -- Giorgos Keramidas, "What we have to learn to do, we learn by doing." [Aristotle] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message