On Jul 1, 2012, at 9:33 AM, Richard Altenburg (Brainchild) wrote:

> If you want to be sure which one works for you, it is probably best to read 
> how Base64 encoding actually works, maybe you find out you can just as easily 
> roll your own solution. Especially on a fast Mac desktop, it would not have 
> to be the worlds' most efficient solution, it will be fast anyways, and 
> always faster than the web server you are uploading to.

Bad idea. You've now added some brand new bit-twiddling code to your app, and 
now you have to test it. Does it handle all lengths of data (there are 3 
different cases, IIRC)? Does it work in big-endian and little-endian? Does it 
work in 64-bit? Does it work if the data is empty or less than 3 bytes long? If 
you've written a decoder, does it handle embedded line-breaks? Does it fail 
gracefully if the input is incorrect? Does it parse all lengths of input?

You get the idea. It's always better to use an already-tested library than to 
roll your own, if it's feasible. This is especially true of code that might be 
parsing untrusted input data (such as a base64 decoder) since bugs in that code 
can often be exploited as attacks.

[I'm aware that the OP doesn't need a decoder for this purpose; but I'm talking 
about the more general issues.]

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to