-2

as it is known that while encoding with base64 encoding method the spaces are skipped but the question is while decoding how they are added back .... ??

consider the following encoding and decoding

string to decode:

TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCAuLi4=

decoded string:

Man is distinguished, not only by his reason, but ...
Ishrak
  • 1
  • 1
    Welcome to superuser. Can you please state a source where it is stated that white spaces are tripped for base64? base64 is only another coding for input data. – Uwe Plonus Sep 17 '14 at 07:12
  • 1
    Your question is based on the wrong assumption. Spaces are not skipped - they are encoded along with the rest of the data. – Art Gertner Sep 17 '14 at 07:43

1 Answers1

2

You misunderstand the premise of base64.

Base64 is for encoding binary blobs into a printable ascii text, the way it does this is taking 6 bits of data at a time and mapping it to one of the 64 characters A-Za-z0-9+/. Everything is included in the blob.

While decoding it looks at each character and maps it back, any whitespace is ignored (read: skipped).