hash2curve

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrZeroLengthDST is returned when a group could not be decoded.
	ErrZeroLengthDST = errors.New("the provided domain separation tag is empty")

	// ErrLengthTooHigh is returned when the requested output length is too large for the hash function or the DST.
	ErrLengthTooHigh = errors.New("requested byte length is too high")

	// ErrXMDOutputSizeTooBig is returned when the provided hash function returns too many bytes.
	ErrXMDOutputSizeTooBig = errors.New("the hash function's output size is too big")
)

Functions

func CheckDST

func CheckDST(dst []byte) error

CheckDST returns an error for invalid DST lengths.

func ExpandXMD

func ExpandXMD(id crypto.Hash, input, dst []byte, length uint) ([]byte, error)

ExpandXMD expands the input and dst using the given fixed length hash function. It implements expand_message_xmd as specified in RFC 9380 section 5.3.1. - dst MUST be non-nil, longer than 0 and lower than 256. It's recommended that DST is at least 16 bytes long. - length must be a positive integer lower than 255 * (size of digest).

func ExpandXMDTo

func ExpandXMDTo(id crypto.Hash, out, input, dst []byte) error

ExpandXMDTo behaves like ExpandXMD but writes the output into out. The requested output length is len(out); cap(out) is ignored. An error is returned if len(out) is too high for the hash function or the DST.

func ExpandXOF

func ExpandXOF(ext *xHash.ExtendableHash, input, dst []byte, length uint) ([]byte, error)

ExpandXOF expands the input and dst using the given extendable output hash function. It implements expand_message_xof as specified in RFC 9380 section 5.3.2. - dst MUST be non-nil and its length longer than 0. It's recommended that DST is at least 16 bytes long. - length must be a positive integer higher than 32.

func VerifyDSTXMD

func VerifyDSTXMD(id crypto.Hash, dst []byte) error

VerifyDSTXMD returns an error if the DST or hash function are not compliant.

func VerifyDSTXOF

func VerifyDSTXOF(x *xHash.ExtendableHash, dst []byte) error

VerifyDSTXOF returns an error if the DST or hash function are not compliant.

func VetDSTXMD

func VetDSTXMD(id crypto.Hash, dst []byte) ([]byte, error)

VetDSTXMD computes a shorter tag for dst if the tag length exceeds 255 bytes. If the DST or the hash function are not compliant, an error is returned.

func VetDSTXOF

func VetDSTXOF(x *xHash.ExtendableHash, dst []byte) ([]byte, error)

VetDSTXOF computes a shorter tag for dst if the tag length exceeds 255 bytes. If the DST or the hash function are not compliant, an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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