Skip to content

Commit

Permalink
update README and help message
Browse files Browse the repository at this point in the history
  • Loading branch information
vtno committed May 18, 2023
1 parent 212fc81 commit 8bca211
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ There are only 2 subcommands `encrypt` and `decrypt`, both have similar options.

```shell
# available options:
# -k, --key A key to be used on encryption / decryption. The length should be:
# 16 bytes for AES-128
# 24 bytes for AES-192
# 32 bytes for AES-256
# -k, --key A key to be used on encryption / decryption. The length should be:
# 16 bytes for AES-128
# 24 bytes for AES-192
# 32 bytes for AES-256
#
# -f, --file A path to file to be encrypted / decrypted
# -o, --out A path to output file
# -f, --file A path to file to be encrypted / decrypted
# -o, --out A path to output file
# -kf, --key-file A path to key file. Default: zypher.key

# encrypting/decrypting from arg to stdout
zypher encrypt -k <AES-KEY> input-to-be-encrypt
Expand All @@ -46,4 +47,9 @@ zypher decrypt -k <AES-KEY> -f input.txt.enc > input.txt
export ZYPHER_KEY=<AES-KEY>
zypher encrypt -f input.txt > input.txt.enc
zypher decrypt -f input.txt.enc > input.txt

# the key is automatically lookup on zypher.key file
# and could be overridden with --key-file flag
zypher encrypt -kf your-own.key -f input.txt -o input.txt.enc
zypher decrypt -kf /some/path/your-own.key -f input.txt.enc -o input.txt
```
7 changes: 4 additions & 3 deletions internal/crypto/decrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ type DecryptCmd struct {
const (
DecryptHelpMsg = `Usage: zypher decrypt [options] <input-value>
available options:
-k, --key=<key> key for encryption/decryption
-f, --file=<path-to-file> input file to be encrypted
-o, --out=<path-to-file> output file to be created
-k, --key=<key> key to encrypt/decrypt
-f, --file=<path-to-file> input file to be encrypted
-o, --out=<path-to-file> output file to be created
-kf, --key-file=<path-to-file> A path to key file. Default: zypher.key
`
DecryptSynopsis = "decrypts input value or file with the provided key and prints the decrypted value to stdout or a file"
)
Expand Down
7 changes: 4 additions & 3 deletions internal/crypto/encrypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import (
const (
HelpMsg = `Usage: zypher encrypt [options] <input-value>
available options:
-k, --key=<key> key to encrypt/decrypt
-f, --file=<path-to-file> input file to be encrypted
-o, --out=<path-to-file> output file to be created
-k, --key=<key> key to encrypt/decrypt
-f, --file=<path-to-file> input file to be encrypted
-o, --out=<path-to-file> output file to be created
-kf, --key-file=<path-to-file> A path to key file. Default: zypher.key
`
SynopsisMsg = "encrypts input value or file with the provided key and prints the encrypted value to stdout or create a file"
)
Expand Down

0 comments on commit 8bca211

Please sign in to comment.