| Base64 encoding is an algorithm which uses 64 printable characters to replace each character from original data in an algorithmic sequence, so that as same we can decode these data. In most of the places we need to Encode or even need to Encrypt most sensitive data when we transfer to other network. Encoding is not encryption. In all our below programs we use Base64 to encode a string that scrambles the output and it may appear to be unreadable binary data. But it can be easily decoded if some have knowledge on encoding algorithms. Most often encoding a string will end with "=" symbol. Apart from encoding there are lot of advanced encryption algorithms like MD5, RSA-SHA etc., which are all not easy to break it.
In java we have got function to encode and decode strings. Lets see simple example for encoding and decoding using sun.misc package classes,
sun.misc classes are not guaranteed to be consistent across different versions of JRE. In those cases we can use 3rd part open source code or jars to encode our data. There are lot of other mechanism to encode and decode our sensitive data and few are,
- Using Apache Commons Codec
- Using Java Mail API (MIME Utility)
- Using MiGBase64
Using Apache Commons Codec - Link to Download
Using Java Mail API (MIME Utility) - Link to Download
Using MiGBase64 - Link to Download
MiGBase64 is a simple and small java class which is fast and effective encoding and decoding algorithm.