Hash-to-curve (RFC 9380)
Deterministic hashing of byte strings to elliptic curve points with the SSWU map
Overview
Hash-to-curve maps arbitrary input to a point on an elliptic curve so that the discrete logarithm of the result is unknown to everyone. RFC 9380 standardises these encodings, which are required by OPRFs, PAKEs, BLS-style signatures and verifiable random functions.
Naive approaches, such as multiplying the generator by a hash, reveal the discrete logarithm of the output and break protocols that rely on it being unknown. Try-and-increment approaches leak timing. RFC 9380 instead first expands the input with a domain separation tag using expand_message_xmd, reduces the result to field elements, and applies a deterministic, constant-time map to the curve. For short Weierstrass curves the map is the simplified Shallue-van de Woestijne-Ulas (SSWU) method.
Two variants exist per suite. The random-oracle (RO) encoding hashes to two field elements, maps both and adds the points, giving an output indistinguishable from a random oracle. The nonuniform (NU) encoding maps a single field element and is cheaper but not uniformly distributed, so it suits only protocols that tolerate this. Both variants are constant time when implemented as specified.
Four suites are present: P256_XMD:SHA-256_SSWU, P384_XMD:SHA-384_SSWU, P521_XMD:SHA-512_SSWU and secp256k1_XMD:SHA-256_SSWU. Because secp256k1 has curve coefficient a = 0, SSWU cannot be applied directly; the suite maps to an isogenous curve and then applies a 3-isogeny back to secp256k1. Applications choose the suite matching the curve and hash used elsewhere in their protocol. The cofactor of each of these curves is one, so no cofactor clearing is needed.
History
2023–2023Specified in RFC 9380 secp256k1_XMD:SHA-256_SSWU_RO_ / _NU_
How it works
- Expand the message and a domain separation tag to a uniform byte string with expand_message_xmd.
- Interpret the bytes as one (NU) or two (RO) field elements.
- Apply the simplified SSWU map to each, via an isogenous curve for secp256k1.
- For RO, add the two points; finally clear the cofactor (trivial for these prime-order curves).
Security notes
Each protocol must use a unique domain separation tag; reusing tags across protocols breaks the independence assumptions. Using the NU encoding where a random oracle is required can undermine security proofs. NextSSL has not yet verified these suites against the RFC test vectors.
Typical uses
Variants in NextSSL
1| Algorithm | Tier | Sizes (bytes) | Standards | API |
|---|---|---|---|---|
| H2c-secp256k1-SHA-256-Sswu h2c-secp256k1-sha256-sswu |
unverified | out 33 | RFC 9380 secp256k1_XMD:SHA-256_SSWU_RO_ / _NU_ | root |
Frequently asked questions
Which Hash-to-curve (RFC 9380) variants does NextSSL include?
NextSSL registers 1 Hash-to-curve (RFC 9380) variant: h2c-secp256k1-sha256-sswu.
Families with similar names
Other hashing to elliptic curves
All 4Related
The NIST Merkle–Damgård hash family behind most of today's TLS, signatures and software
ECDH (including X25519 and X448)Elliptic-curve Diffie-Hellman key agreement on NIST curves, Curve25519 and Curve448
OPRF (RFC 9497)Oblivious pseudorandom function over ristretto255 with SHA-512
OPAQUEAsymmetric PAKE: password login where the server never sees the password
ECDSAElliptic Curve Digital Signature Algorithm on NIST curves and secp256k1