generate MD5 strings with Objective-C?
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.
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.
Apple Man Page for Common Crypto
I used that in an app fairly recently and I'm happy with the results.
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.
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.
Code:
#include <openssl/md5.h>
...
unsigned char md[16];
MD5(data, n, &md);
...gives you the md5 hash as binary
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| C strings | mikey | 24 | 7,673 |
May 18, 2009 04:52 AM Last Post: Oddity007 |
|
| Key sequence to generate end-of-file signal? | WhatMeWorry | 14 | 6,727 |
May 7, 2009 07:25 AM Last Post: Robin Forder |
|
| Where are strings? | Tekkan | 2 | 2,471 |
Jun 17, 2007 02:44 AM Last Post: Fenris |
|
| Converting integer/numeric values to Strings | vnvrymdreglage | 5 | 3,209 |
Oct 23, 2006 07:18 PM Last Post: vnvrymdreglage |
|
| Using a matrix to generate a new vector position | imikedaman | 6 | 3,801 |
Jul 16, 2006 01:17 PM Last Post: imikedaman |
|

