pwencrypt - encrypt Unix-style password

 

SYNOPSIS

<pwencrypt $pass $salt>


DESCRIPTION
The pwencrypt function generates an encrypted Unix-style password for each password value in $pass. The corresponding value of $salt is used as the two-character 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 $salt 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: Dec 10 2018
Copyright © 2019 Thunderstone Software LLC. All rights reserved.