• Home
  • Tags
  • RSS
  • About
  • converting base64 on the commandline

    Timestamp:
    Tags: oneliner

    There is an interesting amount of ways to do that. First line is encoding, second line is decoding.

    using python:

    python -m base64 -e < infile > outfile
    python -m base64 -d < infile > outfile
    

    using openssl (-a is short for -base64):

    openssl enc -a -e < infile > outfile
    openssl enc -a -d < infile > outfile
    

    using base64 (part of the coreutils package):

    base64 < infile > outfile
    base64 -d < infile > outfile
    

    using perl:

    perl -MMIME::Base64 -ne 'print encode_base64($_)' < infile > outfile
    perl -MMIME::Base64 -ne 'print encode_base64($_)' < infile > outfile
    

    using uuencode (but adds a header and footer):

    uuencode -m - < infile > outfile
    uudecode < infile > outfile