Skip to content

sander/hashtocurve-kotlin

Repository files navigation

Hashing to Elliptic Curves for Kotlin

Hashing to Elliptic Curves for Kotlin implements RFC 9380 algorithms for encoding or hashing an arbitrary byte array to a point on an elliptic curve.

Warning

This project has not been independently audited. Help is welcome to increase security or to make risks explicit. Also see the Security policy.

How to build

Run the tests. On POSIX:

./gradlew test

On Windows:

gradlew test

Instead of test, use jar to create a JAR in build/libs.

How to use in an application

Add the hashtocurve-kotlin dependency to your project.

Select a HashToCurve suite and configure a domain separation tag (see Domain Separation Requirements). With the resulting function, you can hash any byte array to the related elliptic curve. The result is encoded as a Point(x: ByteArray, y: ByteArray) with components that contain the big-endian encoding of affine curve point coordinates.

See HashToCurveSpec for example usage.

Test vectors

Some test vectors from RFC 9380 are used.

Related resources

About

Implementation of RFC 9380 algorithms for encoding or hashing an arbitrary byte array to a point on an elliptic curve

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Languages