pwencrypt - encrypt/hash password Unix-style



<pwencrypt $pass $salt>

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.

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.


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

The pwencrypt function was added Oct. 25 1996.

encrypt, decrypt

Copyright © Thunderstone Software     Last updated: Aug 4 2020
Copyright © 2021 Thunderstone Software LLC. All rights reserved.