diff options
author | Poul-Henning Kamp <phk@FreeBSD.org> | 1996-10-14 08:34:02 +0000 |
---|---|---|
committer | Poul-Henning Kamp <phk@FreeBSD.org> | 1996-10-14 08:34:02 +0000 |
commit | 139107f0ffb6dd0428a9c1c5820278923434aafa (patch) | |
tree | 6bc711aa9326459ed3649791231fd0b51400561a /lib/libcrypt/crypt.c | |
parent | 927e7941a3896be9ac767ced766dbf4878e666e6 (diff) | |
download | src-139107f0ffb6dd0428a9c1c5820278923434aafa.tar.gz src-139107f0ffb6dd0428a9c1c5820278923434aafa.zip |
Notes
Diffstat (limited to 'lib/libcrypt/crypt.c')
-rw-r--r-- | lib/libcrypt/crypt.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 7f980e5bd050..ce7b9ee2903c 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -6,28 +6,33 @@ * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp * ---------------------------------------------------------------------------- * - * $Id: crypt.c,v 1.3 1995/05/30 05:42:22 rgrimes Exp $ + * $Id: crypt.c,v 1.4 1996/07/12 18:56:01 jkh Exp $ * */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$Header: /home/ncvs/src/lib/libcrypt/crypt.c,v 1.3 1995/05/30 05:42:22 rgrimes Exp $"; +static char rcsid[] = "$Header: /home/ncvs/src/lib/libcrypt/crypt.c,v 1.4 1996/07/12 18:56:01 jkh Exp $"; #endif /* LIBC_SCCS and not lint */ #include <unistd.h> #include <stdio.h> #include <string.h> #include <md5.h> +#include <string.h> static unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +static void to64 __P((char *, unsigned long, int)); + static void to64(s, v, n) char *s; unsigned long v; int n; { +static void to64 __P((char *, unsigned long, int)); + while (--n >= 0) { *s++ = itoa64[v&0x3f]; v >>= 6; @@ -96,11 +101,11 @@ crypt(pw, salt) memset(final,0,sizeof final); /* Then something really weird... */ - for (j=0,i = strlen(pw); i ; i >>= 1) + for (i = strlen(pw); i ; i >>= 1) if(i&1) - MD5Update(&ctx, final+j, 1); + MD5Update(&ctx, final, 1); else - MD5Update(&ctx, pw+j, 1); + MD5Update(&ctx, pw, 1); /* Now make the output string */ strcpy(passwd,magic); |