Skip to content

Instantly share code, notes, and snippets.

View marsepu's full-sized avatar

Mario Sepulveda marsepu

  • North Hollywood, CA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am marsepu on github.
  • I am marsepu (https://keybase.io/marsepu) on keybase.
  • I have a public key ASBoG0CMBR1zn4RmoEl2kFq6x0OTABsqrF7aAm-iTs8n-Qo

To claim this, I am signing this object:

@marsepu
marsepu / gist:3866910
Created October 10, 2012 17:00
Triple DES Key creation example using CommonCrypto Library
#import <CommonCrypto/CommonKeyDerivation.h>
#import <CommonCrypto/CommonCryptor.h>
- (NSData *)derivedKeyFromPassword:(NSString*)password salt:(NSData*)saltData length:(NSUInteger)keyLength
{
NSMutableData *derivedKey = [NSMutableData dataWithLength:keyLength];
int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm
password.UTF8String, // password
password.length, // passwordLength
saltData.bytes, // salt
@marsepu
marsepu / gist:3854078
Created October 8, 2012 18:28
Triple DES encryption example using the CommonCrypto Library
#import <CommonCrypto/CommonCryptor.h>
#warning ADD Security.framework to your project
+ (NSData *)tripleDesEncryptData:(NSData *)inputData
key:(NSData *)keyData
error:(NSError **)error
{
NSParameterAssert(inputData);
NSParameterAssert(keyData);