Skip to content

Commit b99836a

Browse files
committed
chore: update readme and benchmark results
1 parent e39df6e commit b99836a

7 files changed

+102
-127
lines changed

README.md

+19-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ safelock-cli
99
</a>
1010
</h1>
1111

12-
Fast files encryption (AES-GCM) package and command-line tool built for speed with Go and [Archiver](https://github.com/mholt/archiver)
12+
Fast files encryption package and command-line tool built for speed with Go and [Archiver](https://github.com/mholt/archiver)
13+
14+
Utilizing `argon2id` and `chacha20poly1305` for encryption, see [default options](#options).
15+
1316

1417
### Install
1518

@@ -27,6 +30,7 @@ go get https://github.com/mrf345/safelock-cli@latest
2730

2831
Or using one of the latest release binaries [here](https://github.com/mrf345/safelock-cli/releases)
2932

33+
3034
### Examples
3135

3236
Encrypt a path with default options
@@ -48,10 +52,21 @@ echo "password123456" | safelock-cli encrypt path_to_encrypt encrypted_file_path
4852

4953
You can find interactive examples of using it as a package to [encrypt](https://pkg.go.dev/github.com/mrf345/safelock-cli/safelock#example-Safelock.Encrypt) and [decrypt](https://pkg.go.dev/github.com/mrf345/safelock-cli/safelock#example-Safelock.Decrypt).
5054

51-
### Performance
5255

53-
- Encryption should be about **20.2** times faster than `gpgtar`, and the decryption **3.3** times.
54-
- Encryption should be about **9.1** times faster than `7zip`, and the decryption **9.5** times.
56+
### Options
57+
58+
Following the default options remanded by [RFC9106](https://datatracker.ietf.org/doc/html/rfc9106#section-7.4) and [crypto/argon2](https://pkg.go.dev/golang.org/x/crypto/argon2#IDKey)
59+
60+
| Option | Value |
61+
|-------------------------|---------------------------------------------|
62+
| Iterations | 3 |
63+
| Memory size | 64 Megabytes |
64+
| Key length | 32 |
65+
| Threads | Number of available cores `runtime.NumCPU()`|
66+
| Minimum password length | 8 |
67+
68+
69+
### Performance
5570

5671
> [!NOTE]
5772
> You can reproduce the results by running [bench_and_plot.py](benchmark/bench_and_plot.py) (based on [Matplotlib](https://github.com/matplotlib/matplotlib) and [Hyperfine](https://github.com/sharkdp/hyperfine))

benchmark/bench_and_plot.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import matplotlib.pyplot as plt
66
from matplotlib.colors import XKCD_COLORS as plot_colors
77

8-
safelock_cmd = "~/Projects/safelock-cli/safelock-cli"
8+
safelock_cmd = "safelock-cli"
99
pwd = "123456789"
1010
rest = "60s"
1111
input_path = "Videos"

benchmark/decryption-time.webp

1.14 KB
Binary file not shown.

benchmark/decryption.json

+41-61
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"results": [
33
{
44
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli decrypt test.sla safelock_dump --quiet",
5-
"mean": 2.1295176539933336,
6-
"stddev": 0.03361454776096437,
7-
"median": 2.13093239266,
8-
"user": 2.5876522466666665,
9-
"system": 1.88427306,
10-
"min": 2.0952180726600003,
11-
"max": 2.16240249666,
5+
"mean": 1.8276349158133336,
6+
"stddev": 0.14566191806696024,
7+
"median": 1.9042654354800002,
8+
"user": 2.309450346666667,
9+
"system": 1.9107805599999999,
10+
"min": 1.6596538664800002,
11+
"max": 1.9189854454800002,
1212
"times": [
13-
2.16240249666,
14-
2.13093239266,
15-
2.0952180726600003
13+
1.9189854454800002,
14+
1.9042654354800002,
15+
1.6596538664800002
1616
],
1717
"exit_codes": [
1818
0,
@@ -21,38 +21,18 @@
2121
]
2222
},
2323
{
24-
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli decrypt test_sha256.sla safelock_dump --quiet --sha256",
25-
"mean": 1.8789916449933333,
26-
"stddev": 0.17816416646803604,
27-
"median": 1.98184108566,
28-
"user": 2.0644982466666666,
29-
"system": 1.776121393333333,
30-
"min": 1.67326538666,
31-
"max": 1.9818684626599998,
24+
"command": "sleep 0.05; xdotool type \"123456789\"; xdotool key \"Return\" | age --decrypt test.age | tar x --zstd -f - -C safelock_dump",
25+
"mean": 2.816656686146667,
26+
"stddev": 0.2702910723941267,
27+
"median": 2.9378343294800002,
28+
"user": 2.6122993466666666,
29+
"system": 5.240392226666667,
30+
"min": 2.50698103648,
31+
"max": 3.00515469248,
3232
"times": [
33-
1.67326538666,
34-
1.98184108566,
35-
1.9818684626599998
36-
],
37-
"exit_codes": [
38-
0,
39-
0,
40-
0
41-
]
42-
},
43-
{
44-
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli decrypt test_sha512.sla safelock_dump --quiet --sha512",
45-
"mean": 2.123450407993334,
46-
"stddev": 0.1763774710740607,
47-
"median": 2.1136010126600002,
48-
"user": 2.5975039133333335,
49-
"system": 1.7468127266666666,
50-
"min": 1.95220401166,
51-
"max": 2.3045461996600003,
52-
"times": [
53-
2.3045461996600003,
54-
2.1136010126600002,
55-
1.95220401166
33+
3.00515469248,
34+
2.9378343294800002,
35+
2.50698103648
5636
],
5737
"exit_codes": [
5838
0,
@@ -62,17 +42,17 @@
6242
},
6343
{
6444
"command": "7z e -y -p123456789 -mx1 test.7z -osafelock_dump",
65-
"mean": 17.944166026326666,
66-
"stddev": 0.03535223844853417,
67-
"median": 17.95858265166,
68-
"user": 19.665792913333334,
69-
"system": 1.4092493933333332,
70-
"min": 17.90388353266,
71-
"max": 17.97003189466,
45+
"mean": 18.76303972514667,
46+
"stddev": 0.10991428273642811,
47+
"median": 18.72587103648,
48+
"user": 20.692533679999997,
49+
"system": 1.3673248933333333,
50+
"min": 18.67652879848,
51+
"max": 18.886719340480003,
7252
"times": [
73-
17.97003189466,
74-
17.90388353266,
75-
17.95858265166
53+
18.67652879848,
54+
18.886719340480003,
55+
18.72587103648
7656
],
7757
"exit_codes": [
7858
0,
@@ -82,17 +62,17 @@
8262
},
8363
{
8464
"command": "gpgtar -d --yes --batch --gpg-args \"--passphrase 123456789\" test.gpg",
85-
"mean": 6.240754918993335,
86-
"stddev": 0.18841334623779463,
87-
"median": 6.18021860166,
88-
"user": 0.17699391333333328,
89-
"system": 1.4514090599999998,
90-
"min": 6.09005041466,
91-
"max": 6.45199574066,
65+
"mean": 6.573486912813334,
66+
"stddev": 0.3839886822791872,
67+
"median": 6.52200845048,
68+
"user": 0.21511468,
69+
"system": 1.4525625599999998,
70+
"min": 6.21783424048,
71+
"max": 6.98061804748,
9272
"times": [
93-
6.45199574066,
94-
6.18021860166,
95-
6.09005041466
73+
6.98061804748,
74+
6.52200845048,
75+
6.21783424048
9676
],
9777
"exit_codes": [
9878
0,

benchmark/encryption-time.webp

1.28 KB
Binary file not shown.

benchmark/encryption.json

+41-61
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
"results": [
33
{
44
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli encrypt Videos test.sla --quiet",
5-
"mean": 2.2742533827266667,
6-
"stddev": 0.05119318397940522,
7-
"median": 2.28937216306,
8-
"user": 3.329233973333333,
9-
"system": 1.3630514999999999,
10-
"min": 2.21720349906,
11-
"max": 2.31618448606,
5+
"mean": 2.915796215026667,
6+
"stddev": 0.6152785400365611,
7+
"median": 2.59659688136,
8+
"user": 2.9221347666666673,
9+
"system": 1.8123637266666666,
10+
"min": 2.52571277236,
11+
"max": 3.62507899136,
1212
"times": [
13-
2.21720349906,
14-
2.31618448606,
15-
2.28937216306
13+
3.62507899136,
14+
2.59659688136,
15+
2.52571277236
1616
],
1717
"exit_codes": [
1818
0,
@@ -21,38 +21,18 @@
2121
]
2222
},
2323
{
24-
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli encrypt Videos test_sha256.sla --quiet --sha256",
25-
"mean": 2.2029850927266668,
26-
"stddev": 0.2887786765513728,
27-
"median": 2.29156615106,
28-
"user": 3.45133264,
29-
"system": 1.3318238333333332,
30-
"min": 1.88029167006,
31-
"max": 2.43709745706,
24+
"command": "tar cv --zstd Videos | . /home/mrf3/Projects/safelock-cli/benchmark/pipe_age_password.sh | age -e -p -o test.age",
25+
"mean": 3.5844030323599996,
26+
"stddev": 0.8456093581031698,
27+
"median": 3.99741505136,
28+
"user": 3.664084433333333,
29+
"system": 4.025338726666667,
30+
"min": 2.61165881536,
31+
"max": 4.14413523036,
3232
"times": [
33-
2.43709745706,
34-
1.88029167006,
35-
2.29156615106
36-
],
37-
"exit_codes": [
38-
0,
39-
0,
40-
0
41-
]
42-
},
43-
{
44-
"command": "echo \"123456789\" | ~/Projects/safelock-cli/safelock-cli encrypt Videos test_sha512.sla --quiet --sha512",
45-
"mean": 2.3804781427266666,
46-
"stddev": 0.2607000393652314,
47-
"median": 2.29337213106,
48-
"user": 3.7844909733333325,
49-
"system": 1.4182584999999996,
50-
"min": 2.17448372306,
51-
"max": 2.67357857406,
52-
"times": [
53-
2.67357857406,
54-
2.17448372306,
55-
2.29337213106
33+
2.61165881536,
34+
3.99741505136,
35+
4.14413523036
5636
],
5737
"exit_codes": [
5838
0,
@@ -62,17 +42,17 @@
6242
},
6343
{
6444
"command": "7z a -p123456789 -mx1 test.7z Videos",
65-
"mean": 20.227981493393333,
66-
"stddev": 0.47311415510031346,
67-
"median": 20.17403875506,
68-
"user": 137.52122964,
69-
"system": 0.9545411666666667,
70-
"min": 19.78415073906,
71-
"max": 20.72575498606,
45+
"mean": 20.89819147436,
46+
"stddev": 0.521090452676126,
47+
"median": 20.99556633936,
48+
"user": 144.56984343333332,
49+
"system": 1.0643993933333333,
50+
"min": 20.33528243436,
51+
"max": 21.36372564936,
7252
"times": [
73-
20.72575498606,
74-
20.17403875506,
75-
19.78415073906
53+
21.36372564936,
54+
20.33528243436,
55+
20.99556633936
7656
],
7757
"exit_codes": [
7858
0,
@@ -82,17 +62,17 @@
8262
},
8363
{
8464
"command": "gpgtar -e -o test.gpg -c --yes --batch --gpg-args \"--passphrase 123456789\" Videos",
85-
"mean": 44.902245365726664,
86-
"stddev": 1.3460233818310492,
87-
"median": 44.85683033906,
88-
"user": 33.18701430666666,
89-
"system": 9.421267166666667,
90-
"min": 43.57950423606,
91-
"max": 46.27040152206,
65+
"mean": 44.73956679669333,
66+
"stddev": 3.0879084948438327,
67+
"median": 44.51365098336,
68+
"user": 34.082144766666666,
69+
"system": 9.58027806,
70+
"min": 41.77082056336,
71+
"max": 47.93422884336,
9272
"times": [
93-
46.27040152206,
94-
43.57950423606,
95-
44.85683033906
73+
44.51365098336,
74+
47.93422884336,
75+
41.77082056336
9676
],
9777
"exit_codes": [
9878
0,

benchmark/file-size.webp

1.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)