unistd::crypt Boundry Case
unistd::crypt Boundry Case
- Subject: unistd::crypt Boundry Case
- From: Jesse Thompson <email@hidden>
- Date: Wed, 13 Oct 2004 14:54:05 -0700
I've found a problem with Mac's implementation of crypt. Given the code:
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( int argc, const char **argv )
{
int index = 0;
char c[2] = { 32, 89 };
FILE *outFile = fopen( "crypt.out", "w" );
for( index = 32; index <= 126; index++ ) {
c[0] = index;
fprintf( outFile, "%s\t%c\n", crypt( "cook", c ), c[0] );
}
fclose( outFile );
return 0;
}
Which permutes through the range of printable characters for the first
character of salt, crypt is returning constant results for non [ 0-9,
a-z, A-Z ] characters. The same code on a Linux or Unix box returns
proper hashes. My CS professor states that the crypt function should
conform to NSB's implementation of DES, and this obviously doesn't.
Here's a snip-it of the output of this program:
YE.6Yy26visQ
!YE.6Yy26visQ !
"YE.6Yy26visQ "
#YE.6Yy26visQ #
$YE.6Yy26visQ $
%YE.6Yy26visQ %
&YE.6Yy26visQ &
'YE.6Yy26visQ '
(YE.6Yy26visQ (
)YE.6Yy26visQ )
*YE.6Yy26visQ *
+YE.6Yy26visQ +
,YE.6Yy26visQ ,
-YE.6Yy26visQ -
.YE.6Yy26visQ .
/YevSCZ/FT75w /
0YZZJ3k9.p0dc 0
1YhuSC9o37LLM 1
2Y/fR9L/ylgEk 2
3YVZmoR2ioo8k 3
4YsrD5ASSxdfY 4
5YpX7aBI.FRHM 5
6YWn73aYQNjZk 6
7YGi5LS/mQoyI 7
8Y9fdm4BU9D8k 8
9Y6M4Uw3W2vWI 9
- Jesse
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden