crypthlp

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTimeout = 5 * time.Second

Functions

func Create

func Create(filename string, passphrase []byte, timeout time.Duration) (io.WriteCloser, error)

func CreateWriter

func CreateWriter(w io.Writer, passphrase []byte, timeout time.Duration) (io.WriteCloser, error)

func Salt

func Salt(saltLen int) ([]byte, error)

Salt creates a new random salt with the given length.

Types

type Key

type Key struct {
	Bytes []byte `json:"-"`
	Salt  []byte
	L2N   uint
	R, P  int
}

func GenKey

func GenKey(password []byte, saltLen, keyLen int, timeout time.Duration,
) (Key, error)

GenKey derives a key from the password, using scrypt. It tries to create the strongest key within the given time window.

func Open

func Open(filename string, passphrase []byte) (Key, io.Reader, error)

func OpenReader

func OpenReader(r io.Reader, passphrase []byte) (Key, io.Reader, error)

func (Key) CreateWriter

func (key Key) CreateWriter(w io.Writer) (io.WriteCloser, error)

func (*Key) Populate

func (key *Key) Populate(password []byte, keyLen int) error

func (Key) String

func (key Key) String() string

Jump to

Keyboard shortcuts

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