base64

Base64 encoding for images

I am building a service using WCF and I need to send over images. I looked around on how this is done and found that Base64 encoding is often used to send binary data as text. Is this a good practice to send over images (~500 kb)? ...

Embedding Base64 Images

Purely out of curiosity, what browsers does Base64 image embedding work in? What I'm referring to is this. I realize it's not usually a good solution for most things, as it increases the page size quite a bit - I'm just curious. Some examples: HTML: <img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..."...

Flex: Converting a GUID to Base64

In Flex, I have a GUID that I receive as input in the following format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" as a string. How would I convert this to a string of Base64 encoded values? Please note that we have to account for leading zeroes in each section of the GUID, for example, "0091AFBC-8558-482A-9CF6-64F1745E7AC1" ...

Google App Engine "repackaged" package

What is the purpose of the classes in this package? I want to use Base64 encoding in my app. As I'm typing away in Eclipse, I am prompted if I want to import a class called "com.google.appengine.repackaged.com.google.common.util.Base64" I can't find any documentation about what this class does. No javadoc, or no mention in the Google A...

Code for decoding/encoding a modified base64 URL

I want to base64 encode data to put it in a URL and then decode it within my HttpHandler. I have found that Base64 Encoding allows for a '/' character which will mess up my UriTemplate matching. Then I found that there is a concept of a "modified Base64 for URL" from wikipedia: A modified Base64 for URL variant exists, where no paddin...

how to base64 encode /dev/random or /dev/urandom?

cat /dev/urandom is always a fun way to create scrolling characters on your display but in that output, there is too many non character output. now i was thinking, is there an easy way to encode on the commandline it in such way that all of itś output are readable characters, base64 or uuencode for example. note that i prefer solutions...

Base64 encoding on the iPhone, works in simulator, breaks on device

Hi I am using the simple SMTP client code, first posted on google code at: http://code.google.com/p/skpsmtpmessage/ That repo seems to have gone unmaintained, as the project owner is now employed at apple, and maybe has better things to do. There is a fork of the code, that is more recently maintained at github, which you can find at...

php to silverlight base64 encode/decode

My question is quite similar with this one. But it is php to silverlight. my php code (server encode): $str = 'This is the string'; $encoded = base64_encode($str); How could I achieved the decoded string in Silverlight 2? ...

How to display 'Base64' encoded image in Adobe AIR application using Javascript/HTML

Hello All, I'm having some issues while displaying a 'Base64' encoded image in my AIR application. I'm fetching an image, which is 'Base64' encoded string, in a XML through a web service. At application side I'm able to decode it, but its not been able to display the image on the fly. A little search on Google gave me various result, ...

Passing base64 encoded strings in URL

Is it safe to pass raw base64 encoded strings via GET parameters? ...

Two Base64 encodings yield same decoding

Is it expected behavior that two encodings can map to the same decoding? I'm trying to troubleshoot a digital signature issue by doing sanity checks on base64-encoded intermediate strings. For example, the following base64 encoding: R0VUDQoNCg0KRnJpLCAwNCBTZXAgMjAwOSAxMTowNTo0OSBHTVQrMDA6MDANCi8= and: R0VUCgoKRnJpLCAwNCBTZXAgMjAwOSA...

HttpServerUtility.UrlTokenDecode fails "sometimes" (Invalid length for a Base-64 char array.)

We have an IHttpHandler for stylesheets and add a <link/> tag to the page like this: HtmlGenericControl link = new HtmlGenericControl("link"); link.Attributes.Add("rel", "stylesheet"); link.Attributes.Add("href", "stylesheet.axd?d=" + HttpServerUtility.UrlTokenEncode(token)); head.Controls.Add(link); ...

What character replacements should be performed to make base 64 encoding URL safe?

In looking at URL safe base 64 encoding, I've found it to be a very non-standard thing. Despite the copious number of built in functions that PHP has, there isn't one for URL safe base 64 encoding. On the manual page for [base64_encode()][1], most of the comments suggest using that function, wrapped with strtr(): function base64_url_e...

Base64 decoding - incorrect string length

I'm trying to decode base64-encoded string with openssl. However, it works only 4 times out of 5. Decoded string should always be 64 chars long. BIO_read() always returns 64. However, sometimes returned buffer is shorter than 64! Any ideas what is wrong? How can i always get the correct string? ...

Binary Data in JSON String. Something better than Base64

The JSON format natively doesn't support binary data. The binary data has to be escaped so that it can be places into a string element (i.e. zero or more Unicode chars in double quotes using backslash escapes) in JSON. An obvious method to escape binary data is to use Base64. However, Base64 has a high processing overhead. Also it expan...

double base64 encoding danger & base64 security

I'm adding some capabilities to an api to allow third parties to store user data. I know some users may already base64 encode their user ids before submitting them through the api, others might not. I've done some checking on double encoding (encoding base64 of an already base64 encoded string), and it doesn't SEEM to be causing any pr...

Why can't I round-trip from .png image to base64-encoded, back to .png image w/ PHP?

First quesiton on Stack Overflow, so please be gentle. What I'm trying to do is simple and should be very straightforward in my mind. The results have been less than encouraging. What I'm trying to do: I have a web page that receives base64-encoded PNG image data. I can and have successfully taken that data through the proper steps t...

coding favicon in base64

hello i'm writing a GM user script and i want to change the favicon dynamically changing it the old way is easy but i want to encode it in base64 to avoid hosting it this is what i have done after hosting the favicon var link = document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; link.href = 'http://i...

Given a string, how do I know if it needs decoding

I'm using python's base64 module and I get a string that can be encoded or not encoded. I would like to do something like: if isEncoded(s): output = base64.decodestring(s) else: output = s ideas? ...

Calculate the size to a Base 64 encoded message

I have a binary string that I am encoding in Base 64. Now, I need to know before hand the size of the final Base 64 encoded string will be. Is there any way to calculate that? Something like: BinaryStringSize is 64Kb EncodedBinaryStringSize will be 127Kb after encoding. Oh, the code is in C. Thanks. ...