🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.crypt
Article #1330

Re: DES Encryption/ Encrypting more than once.

#1330
From: Stephen R. Tate
Date: Thu, 15 Oct 1992 19:04
62 lines
2510 bytes
In article <1992Oct15.012933.20350@ringer.cs.utsa.edu> cbarkley@alex (The DarkMage) writes:
>Can anyone send me the PRECISE algorithm used to build a UNIX
>password for the password file?  Source code for it would be
>even nicer.

Geez... can't anyone read a man page any more?  The following program
was trivial to throw together.  It should compile on any UNIX system ---
you don't need to have the source code for the encryption algorithm,
since it is part of the standard C library (on UNIX systems, anyway).

There is a very weak attempt at producing "random looking" salts for
the passwords.  Due to this, even if you run the program twice on the
same password, it should give you two different encrypted versions (this
is fine).  

Use of the program is very simple.  If you compile the program to
an executable named "encpasswd", then "encpasswd foo" gives you an
encrypted form for password "foo".

You may send my consulting fee to the address below. :-)

					Steve Tate

===========================================================================

#include <stdio.h>

char *crypt();

char saltchars[] = 
       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./";

int main(argc, argv)
int argc;
char *argv[];
{
    char salt[3];
    int saltint;

    if (argc < 2) {
	fprintf(stderr, "Usage: %s <password>\n", argv[0]);
        exit(1);
    }

    saltint = getpid() % 4099;
    saltint = (saltint * 2040) % 4099;
    salt[0] = saltchars[ saltint&0x3f ];
    salt[1] = saltchars[ (saltint>>6)&0x3f ];
    salt[2] = '\0';

    puts(crypt(argv[1], salt));

    return(0);
}

========================================================================

-- 
Steve Tate srt@cs.duke.edu | The reason why mathematics enjoys special esteem,
Dept. of Computer Science  | above all other sciences, is that its laws are
Duke University     | absolutely certain and indisputable, while those of all
Durham, NC  27706   | other sciences are to some extent debatable. (Einstein)
Technical Details
Message-ID: <719175856@pike.cs.duke.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!gatech!concert!duke!srt
References: <wa6JsB7w165w@works.uucp> <1992Oct13.174505.24230@b11.b11.ingr.com> <1992Oct15.012933.20350@ringer.cs.utsa.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!destroyer!gatech!concert!duke!srt
From: srt@duke.cs.duke.edu (Stephen R. Tate)
Newsgroups: sci.crypt
Subject: Re: DES Encryption/ Encrypting more than once.
Message-ID: <719175856@pike.cs.duke.edu>
Date: 15 Oct 92 19:04:17 GMT
References: <wa6JsB7w165w@works.uucp> <1992Oct13.174505.24230@b11.b11.ingr.com> <1992Oct15.012933.20350@ringer.cs.utsa.edu>
Organization: Duke University Computer Science Dept.; Durham, N.C.
Lines: 62