#!/bin/bash
#-----------------------------------------------------------------------------
# Use:
# $ ./storeqr.sh "Filename" "YoUR EncRYPtion KeY"
# If you get an error message about parallel not liking -N
# you probably have moreutils installed instead of parallel
# sudo apt-get install parallel
#-----------------------------------------------------------------------------
COUNTER=0
IFS=$'\n'
for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N71 echo) #Low/Default error correction
#for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N56 echo) #Medium error correction
#for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N40 echo) #Q error correction
#for ldata in $( cat $1 |gzip -9 | ccrypt -K "$2" | codegroup | parallel --no-notice -N30 echo) #High error correction
do
let COUNTER+=1
echo "Working on QRcode $COUNTER"
PADCOUNT=$(printf "%08d" $COUNTER)
qrencode -m 8 -o $PADCOUNT.png "$ldata" #Normal/Low error correction
#qrencode -l M -o $PADCOUNT.png "$ldata" #Medium error correction
#qrencode -l Q -o $PADCOUNT.png "$ldata" #Q error correction
#qrencode -l H -o $PADCOUNT.png "$ldata" #high error correction
convert $PADCOUNT.png -gravity South -pointsize 15 -annotate +0+0 "$(basename $1) $PADCOUNT" $PADCOUNT.png
done
#-----------------------------------------------------------------------------
# To restore file from qrcodes:
# $ zbarimg -q --raw *.png | sed 's/[0-9]*//g' |codegroup -d |ccrypt -d -K "YoUR EncRYPtion KeY" |gzip -d > out.file
#-----------------------------------------------------------------------------
Comments