Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

crypt(1)

ed(1)

vi(1)

passwd(4)

makekey(1)                                                       makekey(1)

NAME
     makekey - generate encryption key

SYNOPSIS
     /usr/lib/makekey

DESCRIPTION
     makekey is an encryption routine that is primarily used to encrypt
     passwords [see passwd(4)].

     The makekey command reads from standard input and is normally used in
     pipelines.

   Functionality

     makekey processes 10 bytes of input. The last two input bytes (the
     salt) are used to select the encryption algorithm with which the first
     eight bytes (the input key) are encrypted.

     The first eight bytes can be arbitrary ASCII characters. The last two
     are best chosen from the set of digits, letters, dot (.) and slash
     (/).

     The salt characters are repeated as the first two characters of the
     output. This is followed by 11 bytes representing the encrypted form.

     Caution:

     makekey can produce different results depending upon whether the input
     is typed at the terminal or redirected from a file.

EXAMPLES
     The following shell script named pass.scr defines a password using
     /usr/lib/makekey and then prompts the user to enter this password.

    :
    SECRETKEY='A/'
    #
    #          READ AND ENCRYPT A NEW PASSWORD
    #
    size=0
    while [ "$size" -lt "8" ]
    do echo -n 'Please enter a password (at least 8 characters):'
       stty -echo
       read password
       echo
       stty echo
       set `echo -n $password | wc -c`
       size=$1
    done
    #
    # Strip password to max. 8 characters:



Page 1                       Reliant UNIX 5.44                Printed 11/98

makekey(1)                                                       makekey(1)

    #
    password="`echo $password | awk '{x=substr($0,1,8); printf("%8s\n",x);}'`"
    #
    # Append secret key to password and encrypt password
    #
    password="`echo $password$SECRETKEY | /usr/lib/makekey`"
    #
    # Strip secret key from encrypted password
    #
    CODEDPWD="`echo $password | awk '{x=substr($0,3,11);printf("%11s\n",x);}'`"
    #
    #            USING AN ENCRYPTED PASSWORD
    #
    echo -n 'Enter the password:'
    stty -echo
    read password
    echo
    stty echo
    #
    # Strip password to max. 8 characters:
    #
    password="`echo $password | awk '{x=substr($0,1,8);printf("%8s\n",x);}'`"
    #
    # Append secret key to password and encrypt password
    #
    password="`echo $password$SECRETKEY | /usr/lib/makekey`"
    if [ "$password" != "$SECRETKEY$CODEDPWD" ]
    then echo 'Invalid password'
    else echo 'The entered password was correct !!!'
    fi

SEE ALSO
     crypt(1), ed(1), vi(1), passwd(4).





















Page 2                       Reliant UNIX 5.44                Printed 11/98

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