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: 0

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