How-to: base64 Encode a string using perl.

One way of obfuscating a string is to base64 encode that string. This is not encryption, but there is nothing that stops you from base64 encoding an already encrypted string to obfuscate it even more. Perl makes base64 encoding really easy. Here is a simple one liner that will base64 encode a string. Additionally we also have an example of the reverse showing a base64 decode.


perl -MMIME::Base64 -e 'print MIME::Base64::encode_base64("StringToEncode") . "n"'

Will produce a string that looks like this: U3RyaW5nVG9FbmNvZGU=

To decode simply modify your perl command slightly.


perl -MMIME::Base64 -e 'print MIME::Base64::decode_base64("U3RyaW5nVG9FbmNvZGU=") . "n"'

Which will produce: StringToEncode

That is all there is too it. Happy Encoding/decoding!


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *