-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresult.py
51 lines (43 loc) · 1.69 KB
/
result.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
import csv
import matplotlib.pyplot as plt
COUNT = 50
rsa = []
ecdsa = []
hmac = []
which = [rsa, ecdsa, hmac]
with open('result.csv', newline='') as f:
reader = csv.reader(f, delimiter=',', quotechar='"')
index = 0
for row in reader:
if len(row) == 0:
index += 1
continue
which[index].append([int(row[0]), int(row[1]), int(row[2])])
fig, ax = plt.subplots()
fig.suptitle('GENERATE TOKEN', fontsize=20)
ax.plot([i for i in range(COUNT)], [rsa[i][0] / 1000000 for i in range(COUNT)], label='RSA')
ax.plot([i for i in range(COUNT)], [ecdsa[i][0] / 1000000 for i in range(COUNT)], label='ECDSA')
ax.plot([i for i in range(COUNT)], [hmac[i][0] / 1000000 for i in range(COUNT)], label='HMAC')
ax.grid()
ax.set(xlabel='PERCOBAAN', ylabel='WAKTU (ms)')
ax.legend()
fig.savefig('generate.png')
fig, ax = plt.subplots()
fig.suptitle('TOKEN SIZE', fontsize=20)
ax.plot([i for i in range(COUNT)], [rsa[i][1] for i in range(COUNT)], label='RSA')
ax.plot([i for i in range(COUNT)], [ecdsa[i][1] for i in range(COUNT)], label='ECDSA')
ax.plot([i for i in range(COUNT)], [hmac[i][1] for i in range(COUNT)], label='HMAC')
ax.grid()
ax.set(xlabel='PERCOBAAN', ylabel='SIZE (bytes)')
ax.legend()
fig.savefig('size.png')
fig, ax = plt.subplots()
fig.suptitle('DATA TRANSFER', fontsize=20)
ax.plot([i for i in range(COUNT)], [rsa[i][2] / 1000000 for i in range(COUNT)], label='RSA')
ax.plot([i for i in range(COUNT)], [ecdsa[i][2] / 1000000 for i in range(COUNT)], label='ECDSA')
ax.plot([i for i in range(COUNT)], [hmac[i][2] / 1000000 for i in range(COUNT)], label='HMAC')
ax.grid()
ax.set(xlabel='PERCOBAAN', ylabel='WAKTU (ms)')
ax.legend()
fig.savefig('transfer.png')
print('DONE')