Library Function crypt(3)
crypt(3) is the library function which is used to compute a password hash that can be used to store user account passwords while keeping them relatively secure (a passwd file). The output of the function is not simply the hash— it is a text string which also encodes the salt (usually the first two characters are the salt itself and the rest is the hashed result), and identifies the hash algorithm used (defaulting to the "traditional" one explained below). This output string is what is meant for putting in a password record which may be stored in a plain text file.
This same crypt(3) function is used both to generate a new hash for storage and also to hash a proffered password with a recorded salt for comparison.
If the salt begins with the string $digit$ then the Modular Crypt Format is used. The digit represents which algorithm is used in encryption.
The crypt
library function is also included in the Perl, PHP, Pike, Python, and Ruby programming languages.
Read more about this topic: Crypt (Unix)
Famous quotes containing the words library and/or function:
“Our civilization has decided ... that determining the guilt or innocence of men is a thing too important to be trusted to trained men.... When it wants a library catalogued, or the solar system discovered, or any trifle of that kind, it uses up its specialists. But when it wishes anything done which is really serious, it collects twelve of the ordinary men standing round. The same thing was done, if I remember right, by the Founder of Christianity.”
—Gilbert Keith Chesterton (18741936)
“It is the function of vice to keep virtue within reasonable bounds.”
—Samuel Butler (18351902)