diff -uNr a/lamport-parachute/lamport_decode.sh b/lamport-parachute/lamport_decode.sh --- a/lamport-parachute/lamport_decode.sh false +++ b/lamport-parachute/lamport_decode.sh bdc0823644f0620b45ceac7a95b369dc7fce43d73fb5478bb1ff452c2140b8890511971b1f945e71c98f3b3e4a0f5f2c1769e1382608e49ded0e5716e66c425f @@ -0,0 +1,29 @@ +#!/bin/bash + +if [ $# -lt 2 ] +then + echo "Usage: ./`basename $0` HASHUTIL PUBKEY.TXT < ENCODED.TXT > HEXPAYLOAD" + exit 1 +fi + +bits="" +while read -u 3 pkl; do + if ! read el + then + break + fi + bits="$bits$( + case $(echo -n $el | xxd -r -p | $1 | cut -d ' ' -f1) in + $(echo $pkl | cut -d ' ' -f1)) echo "0" ;; + $(echo $pkl | cut -d ' ' -f2)) echo "1" ;; + *) exit 1; break ;; + esac)" + if [[ $? == 1 ]] + then + echo False >&2; + exit 1 + fi +done 3<$2 + +echo "ibase=2;obase=10000;$bits" | bc | tr -d '\\\n' | tr '[:upper:]' '[:lower:]' +echo diff -uNr a/lamport-parachute/lamport_encode.sh b/lamport-parachute/lamport_encode.sh --- a/lamport-parachute/lamport_encode.sh false +++ b/lamport-parachute/lamport_encode.sh d5e68bebabf4a0b018d7bcad1461b079624bbca9cb0597c95062d08ef60b2f25448c53a7f16c2634ed1e438c354386a9f52183c0accc79cc948cda6f2a760433 @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ $# -lt 1 ] +then + echo "Usage: ./`basename $0` PRIVKEY.TXT < HEXPAYLOAD > ENCODED.TXT" + exit 1 +fi + +payload=$(cat | tr '[:lower:]' '[:upper:]') +len=$((${#payload} * 4)) +bits=$(printf "%*s" $len $(echo "ibase=16;obase=2;$payload" | bc | tr -d '\\\n') | tr ' ' 0) + +while IFS= read -r p; do + bit=${bits:0:1}; + bits=${bits:1}; + echo $p | cut -d ' ' -f$(($bit + 1)); +done < "$1" diff -uNr a/lamport-parachute/lamport_mkpriv.sh b/lamport-parachute/lamport_mkpriv.sh --- a/lamport-parachute/lamport_mkpriv.sh false +++ b/lamport-parachute/lamport_mkpriv.sh 9f627f6096e3bdf48d14b851885c1a25a97d8de5bcc857f7dbccce559fd729672e421035cd01d3c6b862cd1acdc210fd93f5cae84d0b0d93ceabd99a78a01017 @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ $# -lt 2 ] +then + echo "Usage: ./`basename $0` PAYLOADBITS STRENGTHBITS" + exit 1 +fi + +for i in $(seq 1 $(($1 * 2))) ; do + echo `od -N $(($2 / 8)) -An -t x1 /dev/random | tr -d " \n"` ; +done | xargs -n 2 diff -uNr a/lamport-parachute/lamport_priv2pub.sh b/lamport-parachute/lamport_priv2pub.sh --- a/lamport-parachute/lamport_priv2pub.sh false +++ b/lamport-parachute/lamport_priv2pub.sh 09817d1f5bcdde408061a06d9a55f4c1d38976f629834ea7904229c7db50006f5f31c0e19753b9f89ca30b465475a66ef39113dc376a79efa65f392b1ab54f49 @@ -0,0 +1,11 @@ +#!/bin/bash + +if [ $# -lt 1 ] +then + echo "Usage: ./`basename $0` HASHUTIL < PRIVKEY.TXT > PUBKEY.TXT" + exit 1 +fi + +for x in $(cat) ; do + echo -n $x | xxd -r -p | $1 | cut -d ' ' -f1 ; +done | xargs -n 2