Re: unistd::crypt Boundry Case
Re: unistd::crypt Boundry Case
- Subject: Re: unistd::crypt Boundry Case
- From: Frederick Cheung <email@hidden>
- Date: Wed, 13 Oct 2004 23:18:08 +0100
On 13 Oct 2004, at 22:54, Jesse Thompson wrote:
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 };
You want this to be char c[3] = { 32, 89,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:
The man page actually says this about the salt, " These are encoded as
printable characters, 6 bits per character, least significant character
first. The values 0 to 63 are encoded as ``./0-9A-Za-z''
and "The setting is a 2-character array of the ASCII-encoded salt.
Thus only 12 bits of salt are used." which to me implies that this
behaviour is intentional.
Fred
_______________________________________________
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