crypto

package
v0.0.0-...-c86976e Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	NumIterations    = 10000
	SaltLengthBytes  = 8
	PassphraseLength = 16
	KeyLength        = 32

	// IVKeyLength initialization vector in bytes
	// http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf
	// See Section 8.2 & Section 8.2.1, 12 bytes = 96 bits will use
	// deterministic methods to derive a key for passphrase.
	IVKeyLength = 12
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Encrypted string
	Plaintext string
}

func NewMessage

func NewMessage(plaintext string, encrypted string) *Message

func (*Message) Decrypt

func (m *Message) Decrypt(passphrase string) (string, error)

func (*Message) DeriveKey

func (m *Message) DeriveKey(passphrase string, salt []byte) ([]byte, []byte, error)

func (*Message) Encrypt

func (m *Message) Encrypt(passphrase string) (string, error)

func (*Message) RandomPassphrase

func (m *Message) RandomPassphrase() (string, error)

RandomPassphrase godoc Generate random passphrase to encrypt generated data Returns first 16 characters from random passphrase.

Jump to

Keyboard shortcuts

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