#import #include @interface Encryption : NSObject - (void) Encrypt: (NSString *) _secret; @end @implementation Encryption - (void) Encrypt: (NSString *) _secret { const char mykey[] = { 0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41,0x41}; const char mysec[] = { 0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42,0x42}; //NSString *_secret = phrase; NSString *bufferPtr; size_t movedBytes=0; CCCryptorStatus ccStatus; ccStatus = CCCrypt(encrypt, kCCAlgorithmAES128, kCCOptionECBMode, mykey, kCCKeySizeAES256, NULL, mysec, sizeof(_secret), (void *)bufferPtr, sizeof(bufferPtr), &movedBytes ); printf("encrypting %s\n", [ _secret UTF8String ]); printf("encrypted values are:%s\n", [(NSString*) bufferPtr UTF8String]); } @end int main(void) { Encryption *enc = [ [ Encryption alloc ] init ]; [ enc Encrypt: @"Hello, world!" ]; [ enc release ]; return 0; }