In this tutorial I will tell you about recognizing, decoding and encoding with 64 base format.
Base 64 Identification:-
It allows binary data to be transmitted in plain text format without risk of the data.
It is commonly used for encoding email attachments for safe transmission over SMTP and also used for HTTP authentication password.
This includes the entire characters, upper- and lowercase, as well as the ten digits 09. That gives us 62 characters.
Add in plus (+) and solidus (/) and we have 64 Characters. The equals sign is also part of the set, but it only appears at the end.
Base-64 encoding will always contain a number of characters that is a multiple of 4. If
the input data does not encode to an even multiple of 4 bytes, one or more equals (=)
will be added to the end to pad out to a multiple of 4.
64 Character set looks like
Thus, you will see at most 3 equals, but possibly none, 1, or 2. We can identify Base 64 with the mixture of both upper- and lower letters and equal signs appears at the end.
<Base 64 padded with equal sign.
Why using Base 64 Encoding
The Transport system of email protocol is designed for sending plain ASCII text and these ASCII character includes a-z, A-Z, 0-9, ", %, &, ', (, ), *, +, -, _ and , (the comma)and
we can call as Universal ASCII character set.
For example, when you send a file attachments via email then it encode the binary data transported to ASCII plain text so that reciever of email can easily read this ASCII text.
Now I am telling you the encode or decode working with base 64.
So for this we need to install OpenSSL in Cygwin.
Cygwin is looks like a Linux within windows.
1.Download the Cygwin installer from http://www.cygwin.com/
2.Choose installation type "Install from Internet(downloaded files will be kept for future re-use)
3.Choose installation directory "All users" and click on select
4.Enter a temporary installation directory and click next
5.Select "Direct connection" and click next
6.Choose a download site click on next
7.Select the packages you want o install so I want to install openssh and click on next.
8.Once the installation is complete, click finish and continue with setup section.
Suppose we have a encoded string and we need to decode in Cygmin tool Then it can decode like this.
echo 'Q29uZ3JhdHVsYXRpb25zIQ==' | openssl base64 -d
Encode a simple string
% echo -n '&a=1&b=2&c=3' | openssl base64 -e