Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 May 1999 15:30:52 -0400
From:      "Korvus" <korvus@tasam.com>
To:        <freebsd-questions@freebsd.org>
Subject:   how to use crypt()...
Message-ID:  <008201be9a52$764ce820$948cfea9@korvus>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?008201be9a52$764ce820$948cfea9>