A couple of points on the code:

(1) If you're concerned about size, store the IDs in NSData instead of NSString. That way you get the full 8 bits per byte instead of 6, and avoid the complication of translating to and from ASCII.

(2) If you do need to convert to string, it would be safer to use an existing Base64 converter rather than writing your own as you've done. This kind of bit-twiddling code is very prone to error. Probably the quickest way is to use the Base64 support in the OpenSSL library; a bit of searching in the list archives should turn up some sample code.

(3) I'm sort of confused by Thomas Wetmore's comment that "my application generates billions of [unique ids]". That's way too many to be sending over the network, so these must be used locally. But in that case, generating unique IDs becomes much easier, and the IDs a lot smaller: just increment a 32-bit counter.

—Jens_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to