msgexpand

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package msgexpand generates arbitrary bytes from an XOF or Hash function.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrZeroLengthDST indicates that given dst has zero value
	ErrZeroLengthDST = errors.New("msgexpand: zero-length dst")
	// ErrRecommendedDSTLen indicates that given dst length shorter than recommended size
	ErrRecommendedDSTLen = fmt.Errorf("msgexpand: dst length shorter than recommended length (%d)", recommendedDSTLen)
)

Functions

This section is empty.

Types

type MessageExpand

type MessageExpand interface {
	// Expand generates a pseudo-random byte string of a determined length by
	// expanding an input string.
	Expand(in, dst []byte, lenInBytes int) (uniform []byte, err error)
}

MessageExpand is an interface that identify XMD and XOF Expand.

func NewMessageExpandXMD

func NewMessageExpandXMD(h hash.Hashing) MessageExpand

NewMessageExpandXMD returns a expander interface based on a Merkle-Damgård hash functions.

func NewMessageExpandXOF

func NewMessageExpandXOF(id xof.Extendable, secLevel int) MessageExpand

NewMessageExpandXOF returns an expander based on an extendable output functions. The kSecLevel parameter is the target security level in bits.

Jump to

Keyboard shortcuts

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