[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] FW: more info on crypt.
- Subject: [ale] FW: more info on crypt.
- From: ChrisF at computone.com (Chris Fowler)
- Date: Thu, 29 Mar 2001 09:35:21 -0500
Below is code and output of 2 executions
Run 1:
You entered: password
It was encrypted to: ctmNrZ7a6zlUA
The correct password is: ctmNrZ7a6zlUA
Correct!
Run 2:
You entered: password12345
It was encrypted to: ctmNrZ7a6zlUA
The correct password is: ctmNrZ7a6zlUA
Correct!
--------- test.c -----------------
#include <unistd.h>
#define PASSWORD "ctmNrZ7a6zlUA"
int
main(void)
{
?????????????? char password[32];
?????????????? char *encrypted;
?????????????? printf("password: ");
?????????????? scanf("%32s", password);
?????????????? encrypted = crypt(password, PASSWORD);
?????????????? // DEBUG
?????????????? printf("You entered: %s\n", password);
?????????????? printf("It was encrypted to: %s\n", encrypted);
?????????????? printf("The correct password is: %s\n", PASSWORD);
?????????????? // END DEBUG
?????????????? if (strcmp(encrypted, PASSWORD) == 0)
?????????????? ?????????????? printf("Correct!\n");
?????????????? else
?????????????? ?????????????? printf("Incorrect!\n");
?????????????? return 0;
}
??????????????