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