crypt

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 6 Imported by: ? modules, 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypt

type Crypt struct {
	Key  []byte
	Salt []byte
}

func New

func New(sessionkey []byte, salt ...[]byte) (*Crypt, error)

New returns a new Crypt object, with a sha256 cryptographic key and corresponding salt. Parameters: sessionkey A sessionkey (preferably generated with PAKE2). salt Salt used in generating the key. If not supplied a random salt will be generated.

func (*Crypt) Decrypt

func (s *Crypt) Decrypt(encrypted []byte) (decrypted []byte, err error)

Decrypt decrypts the provided message with the the shared key.

func (*Crypt) Encrypt

func (s *Crypt) Encrypt(unencrypted []byte) (encrypted []byte, err error)

Encrypt encrypts the provided message using shared key and a random nonce that is appended to the message.

Jump to

Keyboard shortcuts

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