• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: unistd::crypt Boundry Case
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >unistd::crypt Boundry Case (From: Jesse Thompson <email@hidden>)

  • Prev by Date: Re: NSPrintInfo paperSize and NSFont advancementForGlyph problem
  • Next by Date: Re: CGShading
  • Previous by thread: unistd::crypt Boundry Case
  • Next by thread: Cross project dependencies
  • Index(es):
    • Date
    • Thread