-
+ D5E68BEBABF4A0B018D7BCAD1461B079624BBCA9CB0597C95062D08EF60B2F25448C53A7F16C2634ED1E438C354386A9F52183C0ACCC79CC948CDA6F2A760433
lamport-parachute/lamport_encode.sh
(0 . 0)(1 . 17)
38 #!/bin/bash
39
40 if [ $# -lt 1 ]
41 then
42 echo "Usage: ./`basename $0` PRIVKEY.TXT < HEXPAYLOAD > ENCODED.TXT"
43 exit 1
44 fi
45
46 payload=$(cat | tr '[:lower:]' '[:upper:]')
47 len=$((${#payload} * 4))
48 bits=$(printf "%*s" $len $(echo "ibase=16;obase=2;$payload" | bc | tr -d '\\\n') | tr ' ' 0)
49
50 while IFS= read -r p; do
51 bit=${bits:0:1};
52 bits=${bits:1};
53 echo $p | cut -d ' ' -f$(($bit + 1));
54 done < "$1"