Base64
Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII (American Standard Code for Information Interchange) string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME (Multipurpose Internet Mail Extensions) content transfer encoding.The encoded string with above characters is safe to be transferred over network supporting text data without fear of losing data in confusion of control characters.It is most popular form of the “Base Encoding”.
The following is the character subset of US-ASCII that is used for Base64.
[a-z] – 26 characters
[A-Z] – 26 characters
[0-9] – 10 characters
[+] - 1 character [filler character]
[/] - 1 character [filler character]
[=] - Used for Padding purposes, as explained later.
Encoding a string to base 64
This is as simple as getting an instance of encoder and input the string as bytes to encode it.
Decoding a string to base 64
This is also very simple. Just get the instance of Base64.Decoder and use it to decode the base 64 encoded string.
Output:
Encoded value is TWFub2pAS3VtYXIuY29t
Decoded value is Manoj@kumar.com
Original value is Manoj@kumar.com
The following is the character subset of US-ASCII that is used for Base64.
[a-z] – 26 characters
[A-Z] – 26 characters
[0-9] – 10 characters
[+] - 1 character [filler character]
[/] - 1 character [filler character]
[=] - Used for Padding purposes, as explained later.
Encoding a string to base 64
This is as simple as getting an instance of encoder and input the string as bytes to encode it.
Decoding a string to base 64
This is also very simple. Just get the instance of Base64.Decoder and use it to decode the base 64 encoded string.
Output:
Encoded value is TWFub2pAS3VtYXIuY29t
Decoded value is Manoj@kumar.com
Original value is Manoj@kumar.com
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment
Please Write a Message for Programming or something Related issues.