Menu

Tree [d1d4aa] master v0.2.0 /
 History

HTTPS access


File Date Author Commit
 .github 2024-08-11 Mohamed Feddad Mohamed Feddad [3b89f2] chore: update github release workflow
 cmd 2024-08-12 Mohamed Feddad Mohamed Feddad [db7b9e] fix: move utils to root dir and update docs
 errors 2024-08-15 Mohamed Feddad Mohamed Feddad [046341] refactor: change status percent to float, and a...
 safelock 2024-08-15 Mohamed Feddad Mohamed Feddad [046341] refactor: change status percent to float, and a...
 utils 2024-08-15 Mohamed Feddad Mohamed Feddad [046341] refactor: change status percent to float, and a...
 .gitignore 2024-08-12 Mohamed Feddad Mohamed Feddad [db7b9e] fix: move utils to root dir and update docs
 .golangci.yml 2024-08-11 Mohamed Feddad Mohamed Feddad [c3d409] chore: add boilerplate code and cleanup
 LICENSE 2024-08-11 Mohamed Feddad Mohamed Feddad [c3d409] chore: add boilerplate code and cleanup
 Makefile 2024-08-11 Mohamed Feddad Mohamed Feddad [c3d409] chore: add boilerplate code and cleanup
 README.md 2024-08-15 Mohamed Feddad Mohamed Feddad [a50998] chore: add more accurate stats using binaries
 go.mod 2024-08-12 Mohamed Feddad Mohamed Feddad [db7b9e] fix: move utils to root dir and update docs
 go.sum 2024-08-11 Mohamed Feddad Mohamed Feddad [0dacc9] chore: add more stable code
 main.go 2024-08-12 Mohamed Feddad Mohamed Feddad [fa643e] chore: fix docs example typo

Read Me

safelock-cli Go Reference

Fast files encryption (AES-GCM) package and command-line tool built for speed with Go ⚡

Install

For command-line

go install https://github.com/mrf345/safelock-cli@latest

For packages

go get https://github.com/mrf345/safelock-cli@latest

Or using one of the latest release binaries here

Examples

Encrypt a path with default options

safelock-cli encrypt path_to_encrypt encrypted_file_path

And to decrypt

safelock-cli decrypt encrypted_file_path decrypted_files_path

[!NOTE]
If you want it to run silently with no interaction

echo "password123456" | safelock-cli encrypt path_to_encrypt encrypted_file_path --quiet
Simple example of using it within a package > 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() inputPath := "/home/testing/important" outputPath := "/home/testing/encrypted.sla" password := "testing123456" // Encrypts `inputPath` with the default settings if err := lock.Encrypt(nil, inputPath, 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) } } ```

Performance

With the default settings it should be about twice as fast as gpgtar

> du -hs testing/
1.2G testing/

> time gpgtar --encrypt --output testing.gpg -r user testing/
real    0m42.710s
user    0m41.148s
sys 0m7.943s

> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet
real    0m20.697s
user    0m25.355s
sys 0m9.647s

[!TIP]
You can get even faster performance using the --sha256 flag (less secure)

> time echo "testing123456" | safelock-cli encrypt testing/ testing.sla --quiet --sha256
real    0m16.043s
user    0m17.550s
sys 0m8.707s

And no major file size difference

> ls -lh --block-size=MB testing.gpg
-rw-rw-r-- 1 user user 1247MB Aug 10 12:15 testing.gpg

> ls -lh --block-size=MB testing.sla
-rw-rw-r-- 1 user user 1273MB Aug 10 11:30 testing.sla