raw
lam-par-genesis         1 #!/bin/bash
lam-par-genesis 2
lam-par-genesis 3 if [ $# -lt 2 ]
lam-par-genesis 4 then
lam-par-genesis 5 echo "Usage: ./`basename $0` HASHUTIL PUBKEY.TXT < ENCODED.TXT > HEXPAYLOAD"
lam-par-genesis 6 exit 1
lam-par-genesis 7 fi
lam-par-genesis 8
lam-par-genesis 9 bits=""
lam-par-genesis 10 while read -u 3 pkl; do
lam-par-genesis 11 if ! read el
lam-par-genesis 12 then
lam-par-genesis 13 break
lam-par-genesis 14 fi
lam-par-genesis 15 bits="$bits$(
lam-par-genesis 16 case $(echo -n $el | xxd -r -p | $1 | cut -d ' ' -f1) in
lam-par-genesis 17 $(echo $pkl | cut -d ' ' -f1)) echo "0" ;;
lam-par-genesis 18 $(echo $pkl | cut -d ' ' -f2)) echo "1" ;;
lam-par-genesis 19 *) exit 1; break ;;
lam-par-genesis 20 esac)"
lam-par-genesis 21 if [[ $? == 1 ]]
lam-par-genesis 22 then
lam-par-genesis 23 echo False >&2;
lam-par-genesis 24 exit 1
lam-par-genesis 25 fi
lam-par-genesis 26 done 3<$2
lam-par-genesis 27
lam-par-genesis 28 echo "ibase=2;obase=10000;$bits" | bc | tr -d '\\\n' | tr '[:upper:]' '[:lower:]'
lam-par-genesis 29 echo