title: Base64 in iPhone returning different result than other tools
body: <p>I'm trying to base64 encode an image for upload on iOS, but the stupid thing doesn't have built in support, so I downloaded two libraries and tried them both out, but I think they are returning the wrong values (unless I understand base64 even less than I think I do).  <a href="http://www.motobit.com/util/base64-decoder-encoder.asp" rel="nofollow">This</a> website returns a long string that starts with this:  <code>/9j/4Q+zRXhpZgAASUkqAAgAAAAKAA4BAgAgAAAAhgAAAA8BAgAFAAAApgAAABABAgAKAA</code>
  When I encrypt using the <a href="http://colloquy.info/project/browser/trunk/Additions/NSDataAdditions.m" rel="nofollow">library</a> I downloaded, it starts with this: <code>iVBORw0KGgoAAAANSUhEUgAAAI0AAABnCAIAAACy41YWAABAAElEQVR4AbzdeaylyXUY9nf3</code>
  I am 100% sure the first one is correct, because when I use a test program that was written to test the server, that's the same code that it uploads to the server and the server happily decodes the file and saves the image. <a href="http://singularity-id.com/MyImage.jpg" rel="nofollow">Here</a> is the test image.</p>
  
  <p>Basically, what I'm thinking is that I need to get a different library for the iPhone / iPad. Another odd thing I noticed is that for some images, the = will be at the end of the string, and for others it won't be. There are three reasons I can think of for this.</p>
  
  <p>1) the iPhone is running out of memory and doesn't want to tell me so it just uploads what it has.</p>
  
  <p>2) the library is broken</p>
  
  <p>3) I'm confused and don't understand base64</p>
  
  <p>Any suggestions?</p>
  
  <p>EDIT: The iPhone is actually the simulator, so I don't know if it will run out of memory before the computer does. I know the android emulator doesn't, but I'm not sure about the iOS simulator.</p>