version 1.0.0, 2013-10-24 : Initial version
Encoding and decoding in base64 using perl
One-liners to encode and decode input strings or text files using base64 encodings.
Note
We are using the "MIME" Perl module here. As it is a core module,
it should normally be installed on every systems where perl is installed.
1. Encode
This sentence returns the base64 encoded version of the input (from a file or a pipe. Here, it is from the input_data file).
perl -MMIME::Base64=encode_base64 -e 'print encode_base64 join"",<>' input_data
2. Decode
This command returns the decoded version of a base64 encoded input (from a file or a pipe. Here, it is from the encoded_input_data file).
perl -MMIME::Base64=decode_base64 -e 'print decode_base64 join"",<>' encoded_input_data