Search This Blog

encode Base64 string in command line

  • Encode base64 string:
    echo -n Secret | base64
    
  • Decode base64 string:
    echo -n U2VjcmV0 | base64 -D
    

Note:

When encoding, -n must be specified. otherwise, a newline character will always be appended, which will cause unexpected result.

See http://askubuntu.com/questions/694216/base64-encode-is-giving-ambigious-results

No comments:

Post a Comment