1 import matplotlib.pyplot as plt
8 from matplotlib import style
9 from matplotlib import style
12 from tkinter import filedialog
14 from cycler import cycler
15 ntpath.basename("a/b/c")
21 head, tail = ntpath.split(path)
22 return tail or ntpath.basename(head)
25 # Function is used to get the file-path
27 def uigetfileUserfunction():
30 file_path = filedialog.askopenfilename()
35 def uipostfileUserfunction():
38 root.filename = filedialog.asksaveasfilename(initialdir = "/hn",title = "Select file",filetypes = (("text files","*.eps"),("all files","*.*")))
39 #print (root.filename)
40 resss=path_leaf(root.filename)
47 def plotResults(h,dataf,filename):
48 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
49 # Build the figure and its corresponding parameters
50 #%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#
51 # use ggplot style sheet
53 beingsaved = plt.figure(figsize=(8, 8))
56 plt.xlabel('Buffer Size')
57 plt.ylabel('Execution Time')
58 plt.legend(["Dynamic ECB Encryption", "Dynamic ECB Decryption", "Dynamic CTR ENCRYPTION",
59 "Dynamic CTR DECRYPTION","OpenSSL ECB Encryption"," OpenSSL Decryption ECB",
60 "OpenSSL Encryption CTR","OPENSSL Decryption CTR"],loc='best')
61 matplotlib.rcParams.update({'font.size': 22})
62 plt.grid(True,which="both",ls="-")
64 beingsaved.savefig(filename, format='eps', dpi=1000)
65 filename=filename[0:len(filename)-4]+'.png'
66 beingsaved.savefig(filename, format='png', dpi=1000)
76 # Get the first file-path name
77 str1=uigetfileUserfunction()
78 # Get the second -path name
79 str2=uigetfileUserfunction()
81 #data = np.genfromtxt('execution_oneround_opi.txt')
82 #data3 = np.genfromtxt('execution_openssl_opi.txt')4
84 # Read the first filename
85 data = np.genfromtxt(str1)
86 # Eliminate the first column
87 data2 = np.delete(data, 0, 1) # delete first column of C
89 # Read the second filename
90 data3 = np.genfromtxt(str2)
91 data4 = np.delete(data3, 0, 1) # delete first column of C
93 # Concatenate the both matrices (column-wise)
94 dataf=np.hstack((data2, data4))
95 print(dataf,type(dataf))
97 # Initialization the h vector
98 h=np.asarray([16,64,256,1024,4096,16384,65536, 262144])
100 filename=uipostfileUserfunction()
102 # Call the plotResults function
104 plotResults(h,dataf,filename)