crypto

package
v0.0.0-...-6d05200 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2017 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext []byte, key *memguard.LockedBuffer) ([]byte, error)

Decrypt takes a ciphertext and a 32 byte key, decrypts the ciphertext with said key, and then returns the plaintext.

func DeriveIdentifierN

func DeriveIdentifierN(rootIdentifier *memguard.LockedBuffer, n uint64) []byte

DeriveIdentifierN derives a value for derivedIdentifier for a value of `n`.

func DeriveMetaIdentifierN

func DeriveMetaIdentifierN(rootIdentifier *memguard.LockedBuffer, n int) []byte

DeriveMetaIdentifierN does the same as DeriveIdentifierN but uses signed integers instead of unsigned 64 bit unsigned. The intended purpose is for storing metadata and header information.

func DeriveSecureValues

func DeriveSecureValues(masterPassword, identifier *memguard.LockedBuffer, costFactor map[string]int) (*memguard.LockedBuffer, *memguard.LockedBuffer)

DeriveSecureValues derives and returns a masterKey and rootIdentifier.

func Encrypt

func Encrypt(plaintext []byte, key *memguard.LockedBuffer) []byte

Encrypt takes a plaintext and a 32 byte key, encrypts the plaintext with said key using xSalsa20 with a Poly1305 MAC, and returns the ciphertext.

func GenDecoy

func GenDecoy() (id, ct []byte)

GenDecoy generates and returns a single decoy.

func GenerateRandomBytes

func GenerateRandomBytes(n int) []byte

GenerateRandomBytes generates cryptographically secure random bytes.

func Pad

func Pad(text []byte, padTo int) ([]byte, error)

Pad implements byte padding.

func Unpad

func Unpad(text []byte) ([]byte, error)

Unpad reverses byte padding.

Types

This section is empty.

Jump to

Keyboard shortcuts

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