Categorygithub.com/idelchi/gonc
repositorypackage
0.0.0
Repository: https://github.com/idelchi/gonc.git
Documentation: pkg.go.dev

# README

gonc

Go Reference Go Report Card Build Status License: MIT

gonc is a simple command-line utility that provides secure file encryption, with support for deterministic and non-deterministic modes.

Installation

From source

go install github.com/idelchi/gonc@latest

From installation script

curl -sSL https://raw.githubusercontent.com/idelchi/gonc/refs/heads/dev/install.sh | sh -s -- -d ~/.local/bin

Usage

gonc [flags] command [flags] [paths...]

Global Flags and Environment Variables

FlagEnvironment VariableDescriptionDefaultValid Values
-k, --keyGONC_KEYEncryption key (hex-encoded)-32/64 bytes
-f, --key-fileGONC_KEY_FILEPath to encryption key file-32/64 bytes key
-j, --parallelGONC_PARALLELNumber of parallel workersCPU count> 0
--decrypt-extGONC_DECRYPT_EXTSuffix for decrypted files""-
--encrypt-extGONC_ENCRYPT_EXTSuffix for encrypted files.enc-
-d, --deterministicGONC_DETERMINISTICUse deterministic encryptionfalse-
-q, --quietGONC_QUIETSuppress outputfalse-
-h, --help-Help for gonc--
-v, --version-Version for gonc--

Commands

encrypt (alias: enc) - Encrypt files

Encrypt one or more files using the specified key.

Examples:

# Encrypt files with deterministic mode
gonc -k <key> -d encrypt file1.txt file2.txt
# Output: file1.txt.enc, file2.txt.enc

# Encrypt files with custom extension
gonc -k <key> --encrypt-ext .encrypted encrypt file1.txt
# Output: file1.txt.encrypted

decrypt (alias: dec) - Decrypt files

Decrypt one or more encrypted files using the specified key.

Examples:

# Decrypt files
gonc -k <key> decrypt file1.txt.enc file2.txt.enc
# Output: file1.txt, file2.txt

# Decrypt with custom extension
gonc -k <key> --decrypt-ext .decrypted decrypt file1.txt.enc
# Output: file1.txt.decrypted

Key Format

  • Keys must be hex-encoded
  • Supported lengths: 32 bytes (64 hex characters) or 64 bytes (128 hex characters)
  • Can be provided directly via --key or in a file via --key-file

Encryption Modes

ModeDescriptionUse Case
StandardNon-deterministic encryption using unique noncesDefault mode, maximum security
DeterministicSame input produces same outputWhen detecting changes is important

For detailed help:

gonc --help
gonc <command> --help