2015-04-05 00:24:24 +00:00
|
|
|
encode64() {
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
cat | base64
|
|
|
|
else
|
|
|
|
printf '%s' $1 | base64
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2022-11-06 19:50:39 +00:00
|
|
|
encodefile64() {
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
echo "You must provide a filename"
|
|
|
|
else
|
2024-06-17 18:37:21 +00:00
|
|
|
base64 $1 > $1.txt
|
2022-11-06 19:50:39 +00:00
|
|
|
echo "${1}'s content encoded in base64 and saved as ${1}.txt"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2015-04-05 00:24:24 +00:00
|
|
|
decode64() {
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
cat | base64 --decode
|
|
|
|
else
|
|
|
|
printf '%s' $1 | base64 --decode
|
|
|
|
fi
|
|
|
|
}
|
2012-06-14 10:31:00 +00:00
|
|
|
alias e64=encode64
|
2022-11-06 19:50:39 +00:00
|
|
|
alias ef64=encodefile64
|
2012-06-14 10:31:00 +00:00
|
|
|
alias d64=decode64
|