forked from fukai6/milp_speck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_route_from_sol_1.sh
41 lines (27 loc) · 956 Bytes
/
get_route_from_sol_1.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/bash
read -p "The sol filename is : " filename
read -p "The blocksize is : " blocksize
read -p "The round is : " round
read -p "Differential or linear(input d or l> :" choose
if [ "$choose" = 'd' ]
then
diff="differential"
pron="probability"
mask="differences"
else
diff="linear"
pron="correlation"
mask="linear mask"
fi
printf "The best $diff $pron of $round round of SPECK$blocksize is 2^{-"
head -n 1 $filename | tr "\n\r" "\n" | head -n 1| cut -d" " -f5 | tr "\n" "}"
printf "\n\n"
printf "The $diff path is below:\n\n"
printf "The input $mask of plaintext is:\n"
grep '^p[0-9]* ' $filename | sed 's/p//g' | sort -nk1 | cut -d" " -f2 | tr "\n\r" "\n"| xargs -n 4 | sed 's/ //g' | xargs
for((i=1; i<=$round; i++))
do
printf "The input $mask of the round $i is :\n"
grep "^p[0-9]*Rd$i " $filename | sed -e 's/p//g' -e 's/Rd/ /g' | sort -nk1 | cut -d " " -f3 | tr "\n\r" "\n"| xargs -n 4 | sed 's/ //g' | xargs
done
exit 0