More small bugfixes in the base64 enc/dec functions
This commit is contained in:
parent
41ad6e2aa5
commit
1979b697f3
1 changed files with 5 additions and 7 deletions
12
daisy.source
12
daisy.source
|
|
@ -289,12 +289,11 @@ function daisy_enc()
|
||||||
file_name=$(basename $1)
|
file_name=$(basename $1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
data=$(cat ${1:-/dev/stdin})
|
base64_inner=$(cat ${1:-/dev/stdin} | base64 | tr -d '\n')
|
||||||
base64_inner=$(echo -e "$data" | base64 | tr '\n' '-')
|
|
||||||
|
|
||||||
# Print out our block
|
# Print out our block
|
||||||
printf "# File info: $file_info\n"
|
echo -e "# File info: $file_info"
|
||||||
printf "daisy_data_base64_$file_name=\"$base64_inner\""
|
echo -e "daisy_data_base64_$file_name=\"$base64_inner\""
|
||||||
}
|
}
|
||||||
|
|
||||||
# Will only take input files, always outputs to stdout
|
# Will only take input files, always outputs to stdout
|
||||||
|
|
@ -313,9 +312,8 @@ function daisy_enc_multi()
|
||||||
|
|
||||||
function daisy_dec()
|
function daisy_dec()
|
||||||
{
|
{
|
||||||
data=$(cat ${1:-/dev/stdin} | sed -e 's/.*=\"//g' | grep -v "#" | tr -d '\"' | tr -d "'" | tr '-' '\n' )
|
data=$(cat ${1:-/dev/stdin} | grep -v "#" )
|
||||||
decoded=$(echo -e "$data" | cut -d "=" -f 1 | base64 -d)
|
echo -e "$data" | cut -d "=" -f 2 | cut -b 2- | head -c -1 | base64 -d
|
||||||
printf "$decoded"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Will only take a file and directory, sources it to find all encoded data
|
# Will only take a file and directory, sources it to find all encoded data
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue