#! /bin/bash
#
# mesg1.jpg, mesg2.jpg, mesg3.jpg are files used as messages. They are 
# approxamitely 500b, 1.1k and 7k long respectively. The program creates 3
# set of outputs corresponding to each message. The files outX.key maps 
# the time taken to generate keys against key size. The files outX.en
# maps the encryption time versus key size and outX.de maps the decryption
# time taken against the key sizes. X=1,2,3 stands for the different messages
# The outX.en,outX.de,outX.key files can be given as an input for graph plotting 
# programs. All values(time) are in milli seconds and key sizes are in bits.
#

for i in 128 256 512 768 1024 
do
java RSA $i < mesg1.jpg >> out1
echo "$i => set1"
java RSA $i < mesg2.jpg >> out2
echo "$i => set2"
java RSA $i < mesg3.jpg >> out3
echo "$i => set3"
done

cat out1 | grep Key | cut -f2,4 -d" " > out1.key
cat out1 | grep Encrypt | cut -f2,4 -d" " > out1.en
cat out1 | grep Decrypt | cut -f2,4 -d" "> out1.de

cat out2 | grep Key | cut -f2,4 -d" " > out2.key
cat out2 | grep Encrypt | cut -f2,4 -d" " > out2.en
cat out2 | grep Decrypt | cut -f2,4 -d" "> out2.de

cat out3 | grep Key | cut -f2,4 -d" " > out3.key
cat out3 | grep Encrypt | cut -f2,4 -d" " > out3.en
cat out3 | grep Decrypt | cut -f2,4 -d" "> out3.de

