Re: XCode 2.1 - different result from crypt in deployment and debug?
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