raw
lam-par-genesis         1 #!/bin/bash
lam-par-genesis 2
lam-par-genesis 3 if [ $# -lt 1 ]
lam-par-genesis 4 then
lam-par-genesis 5 echo "Usage: ./`basename $0` PRIVKEY.TXT < HEXPAYLOAD > ENCODED.TXT"
lam-par-genesis 6 exit 1
lam-par-genesis 7 fi
lam-par-genesis 8
lam-par-genesis 9 payload=$(cat | tr '[:lower:]' '[:upper:]')
lam-par-genesis 10 len=$((${#payload} * 4))
lam-par-genesis 11 bits=$(printf "%*s" $len $(echo "ibase=16;obase=2;$payload" | bc | tr -d '\\\n') | tr ' ' 0)
lam-par-genesis 12
lam-par-genesis 13 while IFS= read -r p; do
lam-par-genesis 14 bit=${bits:0:1};
lam-par-genesis 15 bits=${bits:1};
lam-par-genesis 16 echo $p | cut -d ' ' -f$(($bit + 1));
lam-par-genesis 17 done < "$1"