Skip to content

Commit 68a05be

Browse files
committed
chore: update docs and benchmark
1 parent 6df4335 commit 68a05be

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

README.md

+16-15
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ echo "password123456" | safelock-cli encrypt path_to_encrypt encrypted_file_path
5858

5959
func main() {
6060
lock := safelock.New()
61-
inputPath := "/home/testing/important"
61+
inputPaths := []string{"/home/testing/important"}
6262
outputPath := "/home/testing/encrypted.sla"
6363
password := "testing123456"
6464

65-
// Encrypts `inputPath` with the default settings
66-
if err := lock.Encrypt(nil, inputPath, outputPath, password); err != nil {
65+
// Encrypts `inputPaths` with the default settings
66+
if err := lock.Encrypt(nil, inputPaths, outputPath, password); err != nil {
6767
panic(err)
6868
}
6969

@@ -77,31 +77,32 @@ echo "password123456" | safelock-cli encrypt path_to_encrypt encrypted_file_path
7777

7878
### Performance
7979

80-
With the default settings it should be about **twice** as fast as `gpgtar`
80+
With the default settings it should be about **three times** faster than `gpgtar`
8181

8282
```shell
8383
> du -hs testing/
8484
1.2G testing/
8585

86-
> time gpgtar --encrypt --output testing.gpg -r user testing/
87-
real 0m42.710s
88-
user 0m41.148s
89-
sys 0m7.943s
86+
> time gpgtar -e -o testing.gpg -c --yes --batch --gpg-args "--passphrase testing123456" testing/
87+
real 0m40.141s
88+
user 0m33.933s
89+
sys 0m6.930s
90+
9091

9192
> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet
92-
real 0m20.697s
93-
user 0m25.355s
94-
sys 0m9.647s
93+
real 0m8.403s
94+
user 0m10.790s
95+
sys 0m4.832s
9596
```
9697

9798
> [!TIP]
98-
> You can get even faster performance using the `--sha256` flag (less secure)
99+
> You can get slightly better performance using the `--sha256` flag (less secure)
99100
100101
```shell
101102
> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet --sha256
102-
real 0m16.043s
103-
user 0m17.550s
104-
sys 0m8.707s
103+
real 0m8.188s
104+
user 0m10.441s
105+
sys 0m4.709s
105106
```
106107

107108
And no major file size difference

safelock/safelock.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ type Safelock struct {
2323
KeyLength int
2424
// nonce length used to generate the encryption key (default: 12)
2525
NonceLength int
26-
// encrypted/decrypted files buffer size (default: 4096)
26+
// encrypted/decrypted files buffer size (default: 64 * 1024)
2727
BufferSize int
28-
// encryption/decryption channels buffer size increasing/decreasing it might improve performance (default: 5)
28+
// encryption/decryption channels buffer size increasing/decreasing it might improve performance (default: 30)
2929
ChannelSize int
3030
// minimum password length allowed (default: 8)
3131
MinPasswordLength int

0 commit comments

Comments
 (0)