goenc

package module
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

README

goenc

GitHub Releases LICENSE CI Go Reference Go Report Card

A simple file encryption tool

Usage

$ goenc [-d] [<input>] [<output>]

Password can be passed by the environment variable PASSWORD.

$ PASSWORD=<password> goenc [-d] <input> <output>

Installation

Download from GitHub Releases

Build from source
$ go install github.com/cions/goenc/cmd/goenc@latest

Algorithm

  • XChaCha20-Poly1305 for authenticated encryption
  • Argon2id for key derivation

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFormat     = errors.New("not a valid goenc file")
	ErrInvalidTag = errors.New("tag verification failed (password is wrong or data is corrupted)")
)

Functions

func Decrypt added in v0.5.0

func Decrypt(password, input []byte) ([]byte, error)

Decrypt decrypts input with password.

func Encrypt added in v0.5.0

func Encrypt(password, plaintext []byte, opts *Options) ([]byte, error)

Encrypt encrypts plaintext with password.

Types

type Format added in v0.5.0

type Format int

Format represents the file format.

const (
	// FormatDefault indicates that the format is not specified.
	FormatDefault Format = iota

	// FormatV1 represents the goenc version 1 format.
	//
	// Version 1 format uses XChaCha20-Poly1305 for authenticated encryption and Argon2id for key derivation.
	FormatV1
)

type Options added in v0.5.0

type Options struct {
	Format  Format // File format
	Time    uint32 // KDF time parameter
	Memory  uint32 // KDF memory parameter
	Threads uint8  // KDF parallelism parameter
}

Options are encryption parameters.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL