mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-10 23:41:27 +00:00
新增base64_encode工具
This commit is contained in:
@@ -281,9 +281,25 @@ parse_str() {
|
||||
}
|
||||
|
||||
base_encode() {
|
||||
[ -z "${1}" ] && echo -n "" || echo -n "$*" | baseutil --b64
|
||||
if [ -z "${1}" ]; then
|
||||
echo -n ""
|
||||
else
|
||||
if command -v base64_encode &> /dev/null; then
|
||||
echo -n "$*" | base64_encode
|
||||
else
|
||||
echo -n "$*" | baseutil --b64
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
base_decode() {
|
||||
[ -z "${1}" ] && echo -n "" || echo -n "$*" | baseutil --b64 -d
|
||||
if [ -z "${1}" ]; then
|
||||
echo -n ""
|
||||
else
|
||||
if command -v base64_decode &> /dev/null; then
|
||||
echo -n "$*" | base64_decode
|
||||
else
|
||||
echo -n "$*" | baseutil --b64 -d
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user