Hashing to elliptic curves

H2c-P-521-SHA-512-Sswu

Deterministic hashing of byte strings to elliptic curve points with the SSWU map

unverified Root API only
Unverified tier.

Source found and wired, correctness not fully proven. Root API only. Reach it with NextSSL(root=True) in Python or the nextssl_root_* functions in C.

About H2c-P-521-SHA-512-Sswu

H2c-P-521-SHA-512-Sswu is a hash-to-curve suite from the Hash-to-curve (RFC 9380) family. It uses a 67-byte (536-bit) output. Its registry entry cites RFC 9380 P521_XMD:SHA-512_SSWU_RO_ / _NU_. NextSSL lists it in the unverified tier and exposes it through the root API only (NextSSL(root=True) in Python, nextssl_root_* in C).

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–2023
  1. Specified in RFC 9380 P521_XMD:SHA-512_SSWU_RO_ / _NU_

How it works

  1. Expand the message and a domain separation tag to a uniform byte string with expand_message_xmd.
  2. Interpret the bytes as one (NU) or two (RO) field elements.
  3. Apply the simplified SSWU map to each, via an isogenous curve for secp256k1.
  4. 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

Oblivious PRFs and Privacy Pass on NIST curvesPAKEs such as CPace and OPAQUE variantsVerifiable random functions and hash-to-point signaturesDeriving nothing-up-my-sleeve generators

Sizes

FieldBytesMeaning
out67Output

Use it

from nextssl_demo import NextSSL

root = NextSSL(root=True)   # tier 'unverified' is reachable from the root API only
info = root.info("h2c-p521-sha512-sswu")

Calls follow the NextSSL C ABI and its language bindings. Buffer sizes are validated against the sizes above.

Frequently asked questions

What is H2c-P-521-SHA-512-Sswu?

H2c-P-521-SHA-512-Sswu is a hash-to-curve in the Hash-to-curve (RFC 9380) family. 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.

What are the H2c-P-521-SHA-512-Sswu sizes?

In NextSSL, H2c-P-521-SHA-512-Sswu uses: output 67 bytes.

Who designed H2c-P-521-SHA-512-Sswu and when?

H2c-P-521-SHA-512-Sswu belongs to the Hash-to-curve (RFC 9380) family, first published in 2023 by Armando Faz-Hernández, Sam Scott, Nick Sullivan, Riad S. Wahby, Christopher A. Wood. Its origin: IRTF CFRG, RFC 9380.

Which standards define H2c-P-521-SHA-512-Sswu?

H2c-P-521-SHA-512-Sswu is referenced by RFC 9380 P521_XMD:SHA-512_SSWU_RO_ / _NU_.

Is H2c-P-521-SHA-512-Sswu safe to use?

H2c-P-521-SHA-512-Sswu is in the unverified tier. Source found and wired, correctness not fully proven. Root API only. It is only reachable through the root API (NextSSL(root=True) in Python, nextssl_root_* in C).