I am transferring functionality from the Objective-C iPhone app to the Javascript iPhone app (Appcelerator Titanium). In Objective-C, I have an NSData object that represents this token:
<0cd9f571 b0e66e6d ca410d12 f67a404a 7e64b9b5 d2483fd9 63a9267b 1c7609e2>
This is not a string, this is an NSData object - an object-oriented wrapper for a byte buffer. When I base64 encode an object, I get this result:
DNn1cbDmbm3KQQ0S9npASn5kubXSSD/ZY6kmexx2CeI=
In my javascript implementation, I have a string representation of the same token. It looks like this:
//string version of the token in my javascript implementation
0cd9f571b0e66e6dca410d12f67a404a7e64b9b5d2483fd963a9267b1c7609e2
When I base64 encode a string object in javascript, I get this result:
//base64 encoded token (string) in javascript
MGNkOWY1NzFiMGU2NmU2ZGNhNDEwZDEyZjY3YTQwNGE3ZTY0YjliNWQyNDgzZmQ5NjNhOTI2N2IxYzc2MDllMg==
The problem is that the web service I am sending does not want base64 encoding, it wants to get base64 encoded data! How can I do this in javascript?