hash2curve

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 6 Imported by: 2

README

Hash To Curve

hash2curve Go Reference OpenSSF Scorecard codecov

  import "github.com/bytemare/hash2curve"

Package hash2curve implements Hashing to Elliptic Curves as specified in RFC 9380.

What is hash2curve?

Hashing to Elliptic Curves allows for encoding or hashing an arbitrary string to a point on an elliptic curve (or element in a group), therefore benefiting from interesting mathematical properties very useful in cryptographic protocols, like CPace, VOPRF, and OPAQUE.

References

Documentation Go Reference

You can find the documentation and usage examples in the package doc and the project wiki .

Versioning

SemVer is used for versioning. For the versions available, see the tags on the repository.

Contributing

Please read CONTRIBUTING.md for details on the code of conduct, and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

Overview

Package hash2curve Hashing to Elliptic Curves as specified in RFC 9380 (https://datatracker.ietf.org/doc/rfc9380).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandXMD

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

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

func ExpandXOF

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

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

func HashToFieldXMD

func HashToFieldXMD(id crypto.Hash, input, dst []byte, count, ext, securityLength uint, modulo *big.Int) []*big.Int

HashToFieldXMD hashes the input with the domain separation tag (dst) to an integer under modulo, using a merkle-damgard based expander (e.g. SHA256). - dst MUST be non-nil, longer than 0 and lower than 256. It's recommended that DST at least 16 bytes long. - count * ext * securityLength must be a positive integer lower than 255 * (size of digest).

func HashToFieldXOF

func HashToFieldXOF(
	id *hash.ExtendableHash,
	input, dst []byte,
	count, ext, securityLength uint,
	modulo *big.Int,
) []*big.Int

HashToFieldXOF hashes the input with the domain separation tag (dst) to an integer under modulo, using an extensible output function (e.g. SHAKE). - dst MUST be non-nil and its length longer than 0. It's recommended that DST at least 16 bytes long. - count * ext * securityLength must be positive integers higher than 32.

func IsogenySecp256k13iso added in v0.2.1

func IsogenySecp256k13iso(x, y *big.Int) (px, py *big.Int, isIdentity bool)

IsogenySecp256k13iso is a 3-degree isogeny from Secp256k1 3-ISO to the Secp256k1 elliptic curve.

func MapToCurveSSWU added in v0.2.1

func MapToCurveSSWU(a, b, z, fe, order *big.Int) (x, y *big.Int)

MapToCurveSSWU implements the Simplified SWU method for Weierstrass curves for any base field.

Types

This section is empty.

Directories

Path Synopsis
Package internal values, structures, and functions that are not part of the public API.
Package internal values, structures, and functions that are not part of the public API.
field
Package field provides modular operations over very high integers.
Package field provides modular operations over very high integers.

Jump to

Keyboard shortcuts

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