How do I use cat to base64 encode stdin on the fly with openssl?

15,809

If you type

cat | openssl enc -base64

and then press Ctrl+D then it will encode everything you just typed.

Share:
15,809

Related videos on Youtube

nick
Author by

nick

Updated on September 18, 2022

Comments

  • nick
    nick over 1 year

    The following command works for encoding stdin using echo:

    echo "abc" | openssl enc -base64
    

    This command also works for substituting characters in stdin using cat:

    cat | sed 's/a/b/g'
    

    However, the following command, which should encode stdin using cat does not meet my needs, because it doesn't display the encoded value every time I hit return.

    cat | openssl enc -base64
    

    How do I encode stdin on-the-fly using cat?

    • David Schwartz
      David Schwartz about 11 years
      "Don't work" is not a very good problem description.
  • nick
    nick about 11 years
    While that works, I need a continues result. IE I keep typing and every time I hit return, I get an encoded value out
  • Scott - Слава Україні
    Scott - Слава Україні almost 11 years
    @nick: If you want to get satisfactory answers, you should edit your question to add details like this.