encryption

package
v3.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: Apache-2.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const KeySize = 32
View Source
const NonceSize = 12

There are issues with the proof of security with other nonce sizes so we only use 0 (for convergent) or 12

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encryptedData, nonce, secretKey []byte) ([]byte, error)

func DecryptConvergent

func DecryptConvergent(encryptedData, salt, secretKey []byte) ([]byte, error)

Decrypt data that was deterministically encrypted with the provided salt

func Desalinate

func Desalinate(data []byte, length int) (desalted []byte, salt []byte)

func Salinate

func Salinate(data, salt []byte) []byte

Types

type Args

type Args struct {
	BlockCipherMaker BlockCipherMaker
	Nonce            []byte
	SecretKey        []byte
	AdditionalData   []byte
}

type Blob

type Blob struct {
	SecretKey     []byte
	EncryptedData []byte
}

func Encrypt

func Encrypt(data, nonce, secretKey []byte) (*Blob, error)

Encrypt data using random nonce

func EncryptConvergent

func EncryptConvergent(data, salt []byte) (*Blob, error)

Deterministically encrypt data using a supplied salt to produce a distinguished the encrypted result that will have a different content hash, secret key, and address than the same data encrypted with a different salt (or not salt). Can be used to watermark a copy of a blob shared with a particular party or to hide the fact a certain plaintext is stored.

type BlockCipherMaker

type BlockCipherMaker func(key []byte) (cipher.Block, error)

Jump to

Keyboard shortcuts

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