Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macdan56

macrumors newbie
Original poster
Oct 29, 2012
1
0
Hi

i have a key that i want to us and run the key with MD5 ON A sTRING OBJECT

appriciated
Danny
 

chown33

Moderator
Staff member
Aug 9, 2009
10,740
8,416
A sea of green
MD5 is a Message Digest algorithm, not encryption. It doesn't support use of a key.

The simplest way to understand the difference between a message digest and encryption is that encryption is invertible: it allows recovery of the complete original message (the plaintext or cleartext), when decryption is performed with a suitable key. By contrast, message digest algorithms are designed to be non-invertible: the contents of the original message cannot be recovered by any computation performed on the output (the hash value).

To encrypt or hash an NSString, using a suitable algorithm and key, look at the NSString methods that return NSData objects. A returned NSData is a series of bytes in a particular text encoding. The text encoding is passed as a parameter to the method that returns the NSData.
 

jnoxx

macrumors 65816
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
I uploaded a zip with source files for MD5 encryption on NSString.
http://cl.ly/1M420J0b1Y2f

If you put the sourcecode in your application, do the correct #import.
You should be able to call
NSString *md5string = [whateverStringToBeEncrypted md5];
Then your new md5string pointer will contain the md5 encrypted version of whateverStringToBeEncrypted.
Please do mind, there are several different MD5 encryptions, in this case 16 & 32 bit..
They are both in there, just comment the right one out (currently configured for 32 bit).
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.