• 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: XCode 2.1 - different result from crypt in deployment and debug?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: XCode 2.1 - different result from crypt in deployment and debug?


  • Subject: Re: XCode 2.1 - different result from crypt in deployment and debug?
  • From: Alexey Proskuryakov <email@hidden>
  • Date: Thu, 09 Jun 2005 11:39:22 +0400

On 08.06.2005 17:29, "Rick Jansen" <email@hidden> wrote:

> Below's the code. I must have done something wrong...

  Yes, you are working with random locations in memory. When the compiler
gave an error about incorrect pointer types, you shouldn't have shut it up
with a cast. Also, don't forget about the trailing zero in C strings.

>   char pw[8];
>   [Password getCString:(char *)&pw maxLength:8];

  Should be:

   char pw[9];
   [Password getCString:pw maxLength:8];

  Also, getCString:maxLength: is deprecated in 10.4 (they don't say what to
use instead; I recommend CFStringGetCString() ;) )

>   char seed[2];
>   [Seed getCString:(char *)&seed maxLength:2];

  Replicated several more times...

>   // Crypt
>   char encrypted[256];  // Assume 256 is enough
>   char *encryptedPtr;
>   encryptedPtr = (char *)&encrypted;
>   encryptedPtr = crypt( (char *)&pw, (char *)&seed );
>
>   // Convert crypted C-string to NSString
>   NSString *Encoded = [[NSString alloc] initWithCString:encryptedPtr];
>   NSLog(@"CheckRegisterCode: encoded %@ is: %@", Password, Encoded);
>
>   // more code...
>   return NO;
> }

- WBR, Alexey Proskuryakov


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: XCode 2.1 - different result from crypt in deployment and debug?
      • From: Rick Jansen <email@hidden>
References: 
 >Re: XCode 2.1 - different result from crypt in deployment and debug? (From: Rick Jansen <email@hidden>)

  • Prev by Date: Re: Linking with libraries in SDKs
  • Next by Date: Re: Cross Develop using Target SDK setting in .xcconfig file
  • Previous by thread: Re: XCode 2.1 - different result from crypt in deployment and debug?
  • Next by thread: Re: XCode 2.1 - different result from crypt in deployment and debug?
  • Index(es):
    • Date
    • Thread