5
5
import matplotlib .pyplot as plt
6
6
from matplotlib .colors import XKCD_COLORS as plot_colors
7
7
8
- safelock_cmd = "safelock-cli"
8
+ safelock_cmd = "~/Projects/safelock-cli/ safelock-cli"
9
9
pwd = "123456789"
10
10
rest = "60s"
11
11
input_path = "Videos"
12
12
output_name = "test"
13
13
output_dir = "safelock_dump"
14
14
runs = 3
15
15
figure_width = 14
16
- figure_height = 3
16
+ figure_height = 2.5
17
17
bar_width = 0.6
18
18
measure = "Seconds"
19
19
root = os .getcwd ()
@@ -22,8 +22,7 @@ def get_label(i, clean=False, key="command"):
22
22
matchers = [
23
23
('gpg' , 'gpgtar' ,),
24
24
('7z' , '7zip (fastest)' ,),
25
- ('256' , 'safelock --sha256' ,),
26
- ('512' , 'safelock --sha512' ,),
25
+ ('age' , 'age (tar-zstd)' ),
27
26
('safelock' , 'safelock' ,),
28
27
]
29
28
label = next ((v for m , v in matchers if m in i [key ]))
@@ -39,8 +38,7 @@ def get_name(i):
39
38
matchers = [
40
39
('gpg' , f'{ output_name } .gpg' ,),
41
40
('7z' , f'{ output_name } .7z' ,),
42
- ('256' , f'{ output_name } _sha256.sla' ,),
43
- ('512' , f'{ output_name } _sha512.sla' ,),
41
+ ('age' , f'{ output_name } .age' ),
44
42
('safelock' , f'{ output_name } .sla' ,),
45
43
]
46
44
@@ -51,8 +49,7 @@ def encrypt():
51
49
f"hyperfine --runs { runs } --prepare "
52
50
f"'sleep { rest } ' "
53
51
f"'echo \" { pwd } \" | { safelock_cmd } encrypt { input_path } { get_name ('safelock' )} --quiet' "
54
- f"'echo \" { pwd } \" | { safelock_cmd } encrypt { input_path } { get_name ('256' )} --quiet --sha256' "
55
- f"'echo \" { pwd } \" | { safelock_cmd } encrypt { input_path } { get_name ('512' )} --quiet --sha512' "
52
+ f"'tar cv --zstd { input_path } | . { root } /pipe_age_password.sh | age -e -p -o { get_name ('age' )} ' "
56
53
f"'7z a -p{ pwd } -mx1 { get_name ('7z' )} { input_path } ' "
57
54
f"'gpgtar -e -o { get_name ('gpg' )} -c --yes --batch --gpg-args \" --passphrase { pwd } \" { input_path } ' "
58
55
f"--export-json { root } /encryption.json"
@@ -66,8 +63,7 @@ def decrypt():
66
63
f"hyperfine --runs { runs } --prepare "
67
64
f"'rm -rf { output_dir } { output_name } _*_ && mkdir { output_dir } && sleep { rest } ' "
68
65
f"'echo \" { pwd } \" | { safelock_cmd } decrypt { get_name ('safelock' )} { output_dir } --quiet' "
69
- f"'echo \" { pwd } \" | { safelock_cmd } decrypt { get_name ('256' )} { output_dir } --quiet --sha256' "
70
- f"'echo \" { pwd } \" | { safelock_cmd } decrypt { get_name ('512' )} { output_dir } --quiet --sha512' "
66
+ f"'sleep 0.05; xdotool type \" { pwd } \" ; xdotool key \" Return\" | age --decrypt { get_name ('age' )} | tar x --zstd -f - -C { output_dir } ' "
71
67
f"'7z e -y -p{ pwd } -mx1 { get_name ('7z' )} -o{ output_dir } ' "
72
68
f"'gpgtar -d --yes --batch --gpg-args \" --passphrase { pwd } \" { get_name ('gpg' )} ' "
73
69
f"--export-json { root } /decryption.json"
@@ -77,8 +73,8 @@ def decrypt():
77
73
exit (err )
78
74
79
75
os .chdir (os .path .expanduser ("~" ))
80
- encrypt ()
81
- decrypt ()
76
+ # encrypt()
77
+ # decrypt()
82
78
os .chdir (root )
83
79
plt .margins (3.5 )
84
80
@@ -95,7 +91,10 @@ def decrypt():
95
91
fig , ax = plt .subplots ()
96
92
ax .set_title ('Encryption Time' )
97
93
ax .set_xlabel (measure )
98
- ax .barh (labels , scores , bar_width , color = colors )
94
+ ax .yaxis .set_label_position ('right' )
95
+ ax .set_ylabel ('lower is better' )
96
+ ax .grid (zorder = 0 , axis = 'x' , color = 'black' )
97
+ ax .barh (labels , scores , bar_width , color = colors , zorder = 3 )
99
98
fig .set_size_inches (w = figure_width , h = figure_height )
100
99
fig .tight_layout ()
101
100
fig .savefig ("encryption-time.webp" , transparent = True , format = "webp" )
@@ -112,7 +111,10 @@ def decrypt():
112
111
fig , ax = plt .subplots ()
113
112
ax .set_title ('Decryption Time' )
114
113
ax .set_xlabel (measure )
115
- ax .barh (labels , decryption , bar_width , color = colors )
114
+ ax .yaxis .set_label_position ('right' )
115
+ ax .set_ylabel ('lower is better' )
116
+ ax .grid (zorder = 0 , axis = 'x' , color = 'black' )
117
+ ax .barh (labels , decryption , bar_width , color = colors , zorder = 3 )
116
118
fig .set_size_inches (w = figure_width , h = figure_height )
117
119
fig .tight_layout ()
118
120
fig .savefig ("decryption-time.webp" , transparent = True , format = "webp" )
@@ -134,7 +136,10 @@ def decrypt():
134
136
fig , ax = plt .subplots ()
135
137
ax .set_title ('File Size' )
136
138
ax .set_xlabel ("Megabytes" )
137
- ax .barh (labels , sizes , bar_width , color = colors )
139
+ ax .yaxis .set_label_position ('right' )
140
+ ax .set_ylabel ('lower is better' )
141
+ ax .grid (zorder = 0 , axis = 'x' , color = 'black' )
142
+ ax .barh (labels , sizes , bar_width , color = colors , zorder = 3 )
138
143
fig .set_size_inches (w = figure_width , h = figure_height )
139
144
fig .tight_layout ()
140
145
fig .savefig ("file-size.webp" , transparent = True , format = "webp" )
0 commit comments