pwencrypt - encrypt/hash password Unix-style

 

SYNOPSIS

<pwencrypt $pass $salt>


DESCRIPTION
The pwencrypt function generates an encrypted (hashed) Unix-style password for each cleartext password value of pass. The corresponding value of salt is used as the salt; if it is empty a random salt is generated. There must be one or more values of pass and salt; if fewer values of salt exist than pass, the last salt value is re-used.

Only the first 8 characters of pass and the first 2 characters of salt are used.


DIAGNOSTICS
pwencrypt returns each pass password, encrypted Unix-style. A random salt is used if the salt value (pass any initial method id and parameters) is empty.


EXAMPLE

<!-- $enpass is Unix /etc/passwd encrypted password field; -->
<!-- $pass is user password                                -->
<pwencrypt $pass $enpass>
<IF $ret eq $enpass>
  Login ok.
<ELSE>
  Bad login.
</IF>


CAVEATS
The pwencrypt function was added Oct. 25 1996.


SEE ALSO
encrypt, decrypt


Copyright © Thunderstone Software     Last updated: Sep 25 2019
Copyright © 2019 Thunderstone Software LLC. All rights reserved.