Skip to content

Commit

Permalink
feat: update readme for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
mrf345 committed Sep 3, 2024
1 parent fb97b8d commit 6634649
Showing 1 changed file with 17 additions and 61 deletions.
78 changes: 17 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ safelock-cli
</a>
</h1>

Fast files encryption (AES-GCM) package and command-line tool built for speed with Go ⚡
Fast files encryption (AES-GCM) package and command-line tool built for speed with Go and [Archiver](https://github.com/mholt/archiver)

### Install

Expand Down Expand Up @@ -39,78 +39,34 @@ And to decrypt
```shell
safelock-cli decrypt encrypted_file_path decrypted_files_path
```
> [!NOTE]
> If you want it to run silently with no interaction
> [!TIP]
> If you want it to run silently with no interaction use `--quiet` and pipe the password
```shell
echo "password123456" | safelock-cli encrypt path_to_encrypt encrypted_file_path --quiet
```

<details>
<summary>Simple example of using it within a package</summary>

> Checkout [GoDocs](https://pkg.go.dev/github.com/mrf345/safelock-cli/safelock) for more examples and references
```go
package main

import "github.com/mrf345/safelock-cli/safelock"

func main() {
lock := safelock.New()
inputPaths := []string{"/home/testing/important"}
outputPath := "/home/testing/encrypted.sla"
password := "testing123456"

// Encrypts `inputPaths` with the default settings
if err := lock.Encrypt(nil, inputPaths, outputPath, password); err != nil {
panic(err)
}

// Decrypts `outputPath` with the default settings
if err := lock.Decrypt(nil, outputPath, "/home/testing", password); err != nil {
panic(err)
}
}
```
</details>
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).

### Performance

With the default settings it should be about **three times** faster than `gpgtar`

```shell
> du -hs testing/
1.2G testing/
> time gpgtar -e -o testing.gpg -c --yes --batch --gpg-args "--passphrase testing123456" testing/
real 0m40.141s
user 0m33.933s
sys 0m6.930s
> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet
real 0m8.403s
user 0m10.790s
sys 0m4.832s
```
With the default settings it should be about **19.1** times faster than `gpgtar`

> [!TIP]
> You can get slightly better performance using the `--sha256` flag (less secure)
> [!NOTE]
> You can reproduce the results by running [benchmark/bench_and_plot.py](benchmark/bench_and_plot.py) (based on [matplotlib](https://github.com/matplotlib/matplotlib) and [hyperfine](https://github.com/sharkdp/hyperfine))
```shell
> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet --sha256
real 0m8.188s
user 0m10.441s
sys 0m4.709s
```
<p align="center">
<img src="benchmark/encryption-time.webp" align="center" alt="encryption time" />
<img src="benchmark/decryption-time.webp" align="center" alt="encryption time" />
</p>

And no major file size difference
And you could gain a slight file size reduction

```shell
> ls -lh --block-size=MB testing.gpg
-rw-rw-r-- 1 user user 1247MB Aug 10 12:15 testing.gpg
> du -hs test/
1.2G test/

> ls -lh --block-size=MB testing.sla
-rw-rw-r-- 1 user user 1273MB Aug 10 11:30 testing.sla
> ls -lh --block-size=MB test.sla test.gpg
-rw-r--r-- 1 mrf3 mrf3 1.2G Sep 3 17:55 test.gpg
-rw-r--r-- 1 mrf3 mrf3 959M Sep 3 17:29 test.sla
```

0 comments on commit 6634649

Please sign in to comment.