From owner-freebsd-questions Sun May 9 12:34: 0 1999 Delivered-To: freebsd-questions@freebsd.org Received: from tasam.com (tasam.com [209.219.168.22]) by hub.freebsd.org (Postfix) with ESMTP id 640821579E for ; Sun, 9 May 1999 12:33:52 -0700 (PDT) (envelope-from korvus@tasam.com) Received: from korvus (207-172-122-96.s255.tnt7.brd.va.dialup.rcn.com [207.172.122.96]) by tasam.com (8.9.3/8.9.1) with SMTP id PAA27188 for ; Sun, 9 May 1999 15:33:46 -0400 (EDT) Message-ID: <008201be9a52$764ce820$948cfea9@korvus> From: "Korvus" To: Subject: how to use crypt()... Date: Sun, 9 May 1999 15:30:52 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I'm looking to make a quick C program (genpass.c) that can be used in scripts like the following (this is only a quick example, it may not be 100% correct): #!/bin/sh # $1 is a username, $2 is a new password for that user export hashedpass = `echo $2 | genpass` chpass -p "$hashedpass" $1 My only problem in doing this is my incomplete understanding of crypt(). From reading the help files, it appears as if a random 4-byte salt and a 4-byte "iteration count" are used as the second parameter. I have no clue what the "iteration count" should be. I looked at the /usr/src/usr.bin/passwd sources, but I still couldn't fully understand this. If someone could write a quick C program to do this, I would be very thankful (especially if they could also explain the process). Thanks... - Jeff Poole PS I am relatively new to BSD, but I have been using C for a while, so keep that in mind when explaining this process... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message