Skip to content

Instantly share code, notes, and snippets.

@dseg
Created January 5, 2017 06:24
Show Gist options
  • Save dseg/d0e73f91be403d3a3c5a965a2b83b4ec to your computer and use it in GitHub Desktop.
Save dseg/d0e73f91be403d3a3c5a965a2b83b4ec to your computer and use it in GitHub Desktop.
Base64 Encode & Decode
#!/bin/bash
function b64enc {
# エンコード。-e は省略可。
if [[ -n $1 ]] && [[ -f $1 ]]; then
openssl enc -e -base64 "$1"
fi
}
function b64dec {
# デコード
if [[ -n $1 ]] && [[ -f $1 ]]; then
openssl enc -d -base64 "$1"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment