Merging with master; Keeping explicit qrcode symbols for zbarimg;

This commit is contained in:
Brock A. Martin 2016-07-27 22:48:59 -05:00
commit 90e2c0992b
3 changed files with 26 additions and 12 deletions

View file

@ -48,14 +48,13 @@ fi
## Split the key file into usable chunks that the QR encoder can consume
chunks=()
while true; do
s=$( head -c ${max_qr_bytes} )
echo "$s"
IFS= read -r -d'\0' -n ${max_qr_bytes} s
if [ ${#s} -gt 0 ]; then
chunks+=("${s}")
else
break
fi
done <<< "$( cat ${asc_key} )"
done < ${asc_key}
## For each chunk, encode it into a qr image
index=1

View file

@ -33,15 +33,6 @@ if [ $# -lt 1 ]; then
exit 1
fi
# Create a temp file to use as a pattern for splitting the input key file.
# This helps protect against file collisions in the current directory.
export TMPDIR=""
tmp_file=$(mktemp keyparts.XXXXXX)
if [ $? -ne 0 ]; then
echo "failed to create temporary file"
exit 1
fi
# For each image on the command line, decode it into text
chunks=()
index=1

24
test.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "usage: $(basename ${0}) <ascii armor key file>"
exit 1
fi
set -x
asc_key="$1"
./asc2qr.sh "${asc_key}"
./qr2asc.sh QR*.png
diff "${asc_key}" "./mykey.asc"
if [ $? -eq 0 ]; then
echo "Diff Test: PASS"
else
echo "Diff Test: FAIL"
fi
rm ./QR*.png
rm ./mykey.asc