Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a space possible in a base64 encoding?

Is it possible for a string generated from a base64 encoding to have a space (' ') in it?

like image 281
ryanzec Avatar asked Feb 24 '11 21:02

ryanzec


People also ask

Can Base64 have spaces?

Yes. Base64-encoded string can contain white-spaces but the characters are not significant. So it's ok if database trims spaces. As a matter of fact, the original MIME specification recommends to break Base64 strings into lines of 72 characters.

What characters are not allowed in Base64?

The base 64 digits in ascending order from zero are the uppercase characters 'A' to 'Z', lowercase characters 'a' to 'z', numerals '0' to '9', and the symbols '+' and '/'. % is not allowed in base64 encoding.

Is there a limit to Base64 encoding?

The BASE64ENCODE function returns the Base64 encoded version of the binary values of a character string. The schema is SYSTOOLS. A character expression to be encoded. The maximum length in 2732 characters.

What characters are allowed in Base64?

Base64 only contains A–Z , a–z , 0–9 , + , / and = . So the list of characters not to be used is: all possible characters minus the ones mentioned above. For special purposes .


2 Answers

No. Next question?

http://en.wikipedia.org/wiki/Base64#Variants_summary_table

Actually, spaces and CRLFs are usually silently skipped during the decoding, as they might appear as a result of splitting long strings.

like image 146
Cyberax Avatar answered Sep 19 '22 12:09

Cyberax


By reading the http://en.wikipedia.org/wiki/Base64 wiki it seems that in Base64 transfer encoding for MIME (RFC 2045) spaces are allowed and discarded. In all other variants they are forbidden. Ah... and this question is a duplicate: Can a base64 encoded string contain whitespace?

like image 43
xanatos Avatar answered Sep 19 '22 12:09

xanatos