/enc

Encrypt/decrypt files/directories

Primary LanguageGoGNU General Public License v3.0GPL-3.0

Enc

Encrypt/decrypt files/directories

Usage

enc - Encrypt/decrypt files/directories

Usage:  enc [-e|--encrypt] [-p|--password] [-h|--help] <path>

    -e/--encrypt:   To force encryption of an already encrypted archive.
                    Only enc-encrypted archives get decrypted (recognizable by
                    starting with 4 distinctive 'magic' bytes 0x01010101). They
                    get decrypted into a directory "enc_<random-suffix>".
                    The default operation is encryption, resulting in an
                    enc-encrypted compressed archive, ending with ".enc".
    -p|--password:  Instead of encrypting with a randomly generated 32 byte
                    hexadecimal password, the user is prompted for a password.
    -h|--help:      Only show this help text, nothing else

Examples

Making a compressed encrypted archive with a 32 byte hexadecimal password out of file, resulting in file.enc: enc file

Making a compressed encrypted archive with a user-supplied password out of the contents of directory dir, resulting in dir.enc: enc -p dir

Decrypting the contents of enc-encrypted archive dir.enc into directory enc_????????: enc dir.enc

Encrypting enc-encrypted archive file.enc again: enc --encrypt file.enc

Install

  • gobinaries.com: wget -qO- gobinaries.com/pepa65/enc |sh
  • Go get If Golang is installed properly: go get github.com/pepa65/enc
  • Go build/install
    • git clone https://github.com/pepa65/enc; cd enc; go install
    • Smaller binary: go build -ldflags="-s -w"; upx enc
  • Build for other architectures
GOOS=linux GOARCH=arm go build -ldflags="-s -w" -o enc_pi
GOOS=freebsd GOARCH=amd64 go build -ldflags="-s -w" -o enc_freebsd
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o enc_osx
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o enc.exe