generate MD5 strings with Objective-C?

Nibbie
Posts: 1
Joined: 2010.01
Post: #1
Sorry for posting on an old thread, but how may I generate MD5 strings with Objective-C? I really don't know how to do it. Also a sample code is appreciated. Smile
Quote this message in a reply
Member
Posts: 245
Joined: 2005.11
Post: #2
There isn't an objective-C class in Cocoa as far as I know, but the Common Crypto API is pretty easy to use, and very fast.
Apple Man Page for Common Crypto
I used that in an app fairly recently and I'm happy with the results.
Quote this message in a reply
Member
Posts: 144
Joined: 2009.11
Post: #3
fernandovalente Wrote:Sorry for posting on an old thread, but how may I generate MD5 strings with Objective-C? I really don't know how to do it. Also a sample code is appreciated. Smile

An MD5 hash is a number, so just format print a hex number.

Your MD5 library should already have some function for obtaining a string. Or you could try and format print from a 128-bit unsigned integer.

See also http://www.opensource.apple.com/source/t.../md5/md5.c.

Everyone's favourite forum lurker!
https://github.com/NSError
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #4
Code:
#include <openssl/md5.h>
...
unsigned char md[16];
MD5(data, n, &md);
...

gives you the md5 hash as binary
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  C strings mikey 24 8,646 May 18, 2009 04:52 AM
Last Post: Oddity007
  Key sequence to generate end-of-file signal? WhatMeWorry 14 8,619 May 7, 2009 07:25 AM
Last Post: Robin Forder
  Where are strings? Tekkan 2 2,755 Jun 17, 2007 02:44 AM
Last Post: Fenris
  Converting integer/numeric values to Strings vnvrymdreglage 5 3,663 Oct 23, 2006 07:18 PM
Last Post: vnvrymdreglage
  Using a matrix to generate a new vector position imikedaman 6 4,727 Jul 16, 2006 01:17 PM
Last Post: imikedaman