Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

crypt(1)

login(1)

passwd(1)

getpass(3C)

passwd(4)

crypt(3C)

NAME

crypt, crypt_r, setkey, setkey_r, encrypt, encrypt_r − generate hashing encryption

SYNOPSIS

#include <crypt.h>
#include <unistd.h>

char *crypt(const char *key, const char *salt);

char *crypt_r(const char *key, const char *salt, CRYPTD *cd);

void setkey(const char *key);

void setkey_r(const char *key, CRYPTD *cd);

void encrypt(char block[64], int edflag);

void encrypt_r(char block[64], int edflag, CRYPTD *cd);

DESCRIPTION

crypt():

crypt() is the password encryption function.  It is based on a one way hashing encryption algorithm with variations intended (among other things) to frustrate use of hardware implementations of a key search. 

key is a user’s typed password.  salt is a two-character string chosen from the set [a-zA-Z0-9./]; this string is used to perturb the hashing algorithm in one of 4096 different ways, after which the password is used as the key to encrypt repeatedly a constant string.  The returned value points to the encrypted password.  The first two characters are the salt itself. 

setkey() and encrypt():

setkey() and encrypt() provide (rather primitive) access to the actual hashing algorithm.  The argument to setkey() is a character array of length 64 containing only the characters with numerical value 0 and 1.  If this string is divided into groups of 8, the low-order bit in each group is ignored; this gives a 56-bit key which is set into the machine.  This is the key that is used with the hashing algorithm to encrypt or decrypt the string block with the function encrypt(). 

The block argument to encrypt() is a character array of length 64 containing only the characters with numerical value 0 and 1.  The argument array is modified in place to a similar array representing the bits of the argument after having been subjected to the hashing algorithm using the key that was set by setkey().  If edflag is zero, the argument is encrypted; if non-zero it is decrypted. 

Reentrant Interfaces

cd is a pointer to a CRYPTD object, which is defined in <crypt.h>. 

For crypt_r(), cd is used as a buffer to store the result string. 

In the case of setkey_r() and encrypt_r(), cd is used to hold key information set by the setkey_r() call, and used by the encrypt_r() call. 

SEE ALSO

crypt(1), login(1), passwd(1), getpass(3C), passwd(4). 

WARNINGS

The return value for crypt() points to static data whose content is overwritten by each call.  crypt(), setkey(), and encrypt() are unsafe in multi-thread applications.  crypt_r(), setkey_r(), and encrypt_r() are MT-Safe and should be used instead. 

STANDARDS CONFORMANCE

crypt(): SVID2, SVID3, XPG2, XPG3, XPG4

encrypt(): SVID2, SVID3, XPG2, XPG3, XPG4

setkey(): SVID2, SVID3, XPG2, XPG3, XPG4

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026