[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

crypt() woes - error in man page?



i think there's an error in the man page for crypt()...

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

from the man page:

	salt  is  a  two-character  string  chosen  from  the  set
	[a-zA-Z0-9./].  This string is used to perturb  the  algo-
	rithm in one of 4096 different ways.

	If  the salt starts with $1$ an MD5 based password hashing
	algoritm is applied. The salt should consist off $1$  fol-
	lowed with eight characters.

the program:

	#include<stdio.h>
	#include<crypt.h>
	int main(int argc, char *argv[])
	{
		char salt1[] = "ab";
		char salt2[] = "$1$12345678";
		char key[] = "password";    /*   :-)   */
		char *pass1 = crypt(salt1, key);
		char *pass2 = crypt(salt2, key);
		printf("DES: %s\nMD5: %s\n", pass1, pass2);
		return(0);
	}

the compile:
		gcc -lcrypt -Wall -ansi -pedantic crypto.c

the output:

		# ./a.out
		DES: paWN9Y6oTBa/Q
		MD5: paWN9Y6oTBa/Q

i assume they're both DES.   help?

pete




Reply to: