Base64.m
changeset 1 e55a17cdabd2
parent 0 d84d25d6cdbb
child 11 e5976864dfe9
     1.1 --- a/Base64.m	Sat Mar 08 21:04:41 2008 -0800
     1.2 +++ b/Base64.m	Thu Mar 20 09:05:58 2008 -0700
     1.3 @@ -10,11 +10,13 @@
     1.4  //
     1.5  
     1.6  #import "Base64.h"
     1.7 +
     1.8 +//NOTE: Using this requires linking against /usr/lib/libcrypto.dylib.
     1.9  #import <openssl/bio.h>
    1.10  #import <openssl/evp.h>
    1.11  
    1.12  
    1.13 -@implementation NSData (Base64)
    1.14 +@implementation NSData (MYBase64)
    1.15  
    1.16  
    1.17  /**
    1.18 @@ -24,9 +26,9 @@
    1.19   * Code courtesy of DaveDribin (http://www.dribin.org/dave/)
    1.20   * Taken from http://www.cocoadev.com/index.pl?BaseSixtyFour
    1.21   **/
    1.22 -- (NSString *)base64String
    1.23 +- (NSString *)my_base64String
    1.24  {
    1.25 -    return [self base64StringWithNewlines: YES];
    1.26 +    return [self my_base64StringWithNewlines: YES];
    1.27  }
    1.28  
    1.29  /**
    1.30 @@ -36,7 +38,7 @@
    1.31   * Code courtesy of DaveDribin (http://www.dribin.org/dave/)
    1.32   * Taken from http://www.cocoadev.com/index.pl?BaseSixtyFour
    1.33   **/
    1.34 -- (NSString *)base64StringWithNewlines:(BOOL)encodeWithNewlines
    1.35 +- (NSString *)my_base64StringWithNewlines:(BOOL)encodeWithNewlines
    1.36  {
    1.37      // Create a memory buffer which will contain the Base64 encoded string
    1.38      BIO * mem = BIO_new(BIO_s_mem());
    1.39 @@ -61,12 +63,12 @@
    1.40      return base64String;
    1.41  }
    1.42  
    1.43 -- (NSData *)decodeBase64
    1.44 +- (NSData *)my_decodeBase64
    1.45  {
    1.46 -    return [self decodeBase64WithNewLines:YES];
    1.47 +    return [self my_decodeBase64WithNewLines:YES];
    1.48  }
    1.49  
    1.50 -- (NSData *)decodeBase64WithNewLines:(BOOL)encodedWithNewlines
    1.51 +- (NSData *)my_decodeBase64WithNewLines:(BOOL)encodedWithNewlines
    1.52  {
    1.53      // Create a memory buffer containing Base64 encoded string data
    1.54      BIO * mem = BIO_new_mem_buf((void *) [self bytes], [self length]);
    1.55 @@ -90,7 +92,7 @@
    1.56  }
    1.57  
    1.58  
    1.59 -- (NSString *)hexString
    1.60 +- (NSString *)my_hexString
    1.61  {
    1.62      const UInt8 *bytes = self.bytes;
    1.63      NSUInteger length = self.length;
    1.64 @@ -102,7 +104,7 @@
    1.65              autorelease];
    1.66  }
    1.67  
    1.68 -- (NSString *)hexDump
    1.69 +- (NSString *)my_hexDump
    1.70  {
    1.71      NSMutableString *ret=[NSMutableString stringWithCapacity:[self length]*2];
    1.72      /* dumps size bytes of *data to string. Looks like: