• 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: Rick Jansen <email@hidden>
  • Date: Thu, 09 Jun 2005 11:43:45 +0200

Alexey Proskuryakov zee op 9/6/05 09:39:
> 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.

Argh, I've been away from this kind of thing too long, I completely
overlooked it and messed up. It works now. Thanks!

    NSString *Seed = [Password substringToIndex:1];  // 2st char pw
    Seed = [Seed stringByAppendingString:[Password
substringFromIndex:([Password length]-1) ]];    // Append last char pw
    NSLog(@"CheckRegisterCode: pw=%@ seed=%@",
Password, Seed);

    // Convert Unicode NSString to C-string. 8 chars max.
    char pw[9];
    if ([Password length] > 8) Password = [Password substringToIndex:8];

    [Password getCString:pw maxLength:8];

    // Convert Unicode seed (2 chars)
    char seed[3];
    [Seed getCString:seed maxLength:2];

    // Crypt and convert crypted C-string to NSString
    NSString *Encoded =
        [[NSString alloc] initWithCString:crypt(pw,seed)];

    NSLog(@"PreferencesController: CheckRegisterCode: encoded %@ is:
%@", Password, Encoded);

Rick (shamefaced)


 _______________________________________________
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

References: 
 >Re: XCode 2.1 - different result from crypt in deployment and debug? (From: Alexey Proskuryakov <email@hidden>)

  • Prev by Date: Cross development with SDK 10.3.9 not compatible with 10.3.8
  • Next by Date: Re: Undefined: _fprintf$LDBLStub
  • Previous by thread: Re: XCode 2.1 - different result from crypt in deployment and debug?
  • Next by thread: how can I use zlib when building a Universal Binary?
  • Index(es):
    • Date
    • Thread