Re: Get MD5 without crashing
Re: Get MD5 without crashing
- Subject: Re: Get MD5 without crashing
- From: Alex Heinz <email@hidden>
- Date: Mon, 3 Nov 2008 23:46:17 -0500
You probably want [[[crypto digest:@"MD5"] hexval] autorelease]. This
will add the NSString object to the autorelease pool, instead of the
SSCrypto object, as you are doing now.
HTH,
Alex
On Nov 3, 2008, at 9:05 PM, Mr. Gecko wrote:
Hello I am trying to MD5 a whole bunch of strings and I choose
SSCrypto for it, but for some reason, it crashes because of memory.
I know it has to do with releasing, I haven't found much details on
when to use release and autorelease; so this is a huge task for me
to find out.
Here is my method I have made.
- (NSString *)md5:(NSString *)MD5 {
SSCrypto *crypto = [[SSCrypto alloc] init];
[crypto setClearTextWithString:MD5];
return [[[crypto autorelease] digest:@"MD5"] hexval];
}
if you could point out what I am doing wrong, I would be great full.
Thanks,
Mr. Gecko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden