Skip to content

Instantly share code, notes, and snippets.

@trevorsheridan
Created August 12, 2013 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trevorsheridan/6213953 to your computer and use it in GitHub Desktop.
Save trevorsheridan/6213953 to your computer and use it in GitHub Desktop.
CocoaSecurity Base64 encoding example
#import <CocoaSecurity/CocoaSecurity.h>
- (NSString *)encodeUsername:(NSString *)username password:(NSString *)password
{
CocoaSecurityEncoder *encoder = [[CocoaSecurityEncoder alloc] init];
NSString *pair = [NSString stringWithFormat:@"%@:%@", username, password];
return [encoder base64:[pair dataUsingEncoding:NSUTF8StringEncoding]];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment