mirror of
https://github.com/plantroon/acme.sh.git
synced 2024-12-26 15:02:03 +00:00
fix for performance of _h2b() function
This commit is contained in:
parent
2844d73dc7
commit
b420ec6cb9
27
acme.sh
27
acme.sh
@ -444,19 +444,27 @@ if [ "$(printf '\x41')" != 'A' ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
_h2b() {
|
_h2b() {
|
||||||
|
if _exists xxd; then
|
||||||
|
xxd -r -p
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
hex=$(cat)
|
hex=$(cat)
|
||||||
i=1
|
i=1
|
||||||
j=2
|
j=2
|
||||||
|
_debug2 _URGLY_PRINTF "$_URGLY_PRINTF"
|
||||||
_debug3 _URGLY_PRINTF "$_URGLY_PRINTF"
|
if [ -z "$_URGLY_PRINTF" ]; then
|
||||||
while true; do
|
while true; do
|
||||||
if [ -z "$_URGLY_PRINTF" ]; then
|
|
||||||
h="$(printf "%s" "$hex" | cut -c $i-$j)"
|
h="$(printf "%s" "$hex" | cut -c $i-$j)"
|
||||||
if [ -z "$h" ]; then
|
if [ -z "$h" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
printf "\x$h%s"
|
printf "\x$h%s"
|
||||||
else
|
i="$(_math "$i" + 2)"
|
||||||
|
j="$(_math "$j" + 2)"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
ic="$(printf "%s" "$hex" | cut -c $i)"
|
ic="$(printf "%s" "$hex" | cut -c $i)"
|
||||||
jc="$(printf "%s" "$hex" | cut -c $j)"
|
jc="$(printf "%s" "$hex" | cut -c $j)"
|
||||||
if [ -z "$ic$jc" ]; then
|
if [ -z "$ic$jc" ]; then
|
||||||
@ -465,12 +473,11 @@ _h2b() {
|
|||||||
ic="$(_h_char_2_dec "$ic")"
|
ic="$(_h_char_2_dec "$ic")"
|
||||||
jc="$(_h_char_2_dec "$jc")"
|
jc="$(_h_char_2_dec "$jc")"
|
||||||
printf '\'"$(printf "%o" "$(_math "$ic" \* 16 + $jc)")""%s"
|
printf '\'"$(printf "%o" "$(_math "$ic" \* 16 + $jc)")""%s"
|
||||||
fi
|
i="$(_math "$i" + 2)"
|
||||||
|
j="$(_math "$j" + 2)"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
i="$(_math "$i" + 2)"
|
|
||||||
j="$(_math "$j" + 2)"
|
|
||||||
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_is_solaris() {
|
_is_solaris() {
|
||||||
|
Loading…
Reference in New Issue
Block a user