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