{
  "id": "2023/1261",
  "url": "https://opencryptology.org/2023/1261",
  "original_url": "https://eprint.iacr.org/2023/1261",
  "title": "Faster constant-time evaluation of the Kronecker symbol with application to elliptic curve hashing",
  "authors": [
    "Diego F. Aranha",
    "Benjamin Salling Hvass",
    "Bas Spitters",
    "Mehdi Tibouchi"
  ],
  "affiliations": null,
  "abstract": "We generalize the Bernstein-Yang (BY) algorithm for constant-time modular inversion to compute the Kronecker symbol, of which the Jacobi and Legendre symbols are special cases. We start by developing a basic and easy-to-implement divstep version of the algorithm defined in terms of full-precision division steps. We then describe an optimized version due to Hamburg over word-sized inputs, similar to the jumpdivstep version of the BY algorithm, and formally verify its correctness. Along the way, we introduce a number of optimizations for implementing both versions in constant time and at high-speed. The resulting algorithms are particularly suitable for the special case of computing the Legendre symbol with dense prime $p$, where no efficient addition chain is known for the conventional approach by exponentiation to $\\frac{p-1}{2}$. This is often the case for the base field of popular pairing-friendly elliptic curves. Our high-speed implementation for a range of parameters shows that the new algorithm is up to 40 times faster than the conventional exponentiation approach, and up to 25.7\\% faster than the previous state of the art. We illustrate the performance of the algorithm with an application for hashing to elliptic curves, where the observed savings amount to 14.7\\% -- 48.1\\% when used for testing quadratic residuosity within the SwiftEC hashing algorithm. We also apply our techniques to the CTIDH isogeny-based key exchange, with savings of 3.5--13.5\\%.",
  "category": "Implementation",
  "license": {
    "code": "CC BY",
    "url": "https://creativecommons.org/licenses/by/4.0/",
    "label": "CC BY 4.0",
    "attribution": "“Faster constant-time evaluation of the Kronecker symbol with application to elliptic curve hashing” by Diego F. Aranha, Benjamin Salling Hvass, Bas Spitters, Mehdi Tibouchi, Cryptology ePrint Archive, Paper 2023/1261, https://eprint.iacr.org/2023/1261. Licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).",
    "retroactive": false,
    "redistribute_verbatim_only": false,
    "non_commercial": false
  },
  "dates": {
    "submitted": "2023-08-21T12:59:51Z",
    "updated": "2025-08-18T12:05:29Z",
    "withdrawn": null
  },
  "withdrawn": false,
  "withdrawn_on": null,
  "pdf": {
    "url": "https://opencryptology.org/2023/1261.pdf",
    "sha256": "1dd7b1fb6f8caae622c8b0d9bf8056fa10e2edec4a6c0b7cb59e00554ab1d515",
    "size": 736473,
    "source": "github-mirror",
    "source_date": "2026-04-28T17:20:00Z",
    "maybe_stale": false,
    "newer_on_eprint": null,
    "eprint_size": null,
    "withdrawn": false
  },
  "versions": [
    {
      "url": "https://opencryptology.org/2023/1261/versions/20260428T172000Z.pdf",
      "captured_at": "2026-04-28T17:20:00Z",
      "label": "copy captured 2026-04-28",
      "source": "github-mirror",
      "source_url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2023/1261.pdf",
      "size": 736473,
      "sha256": "1dd7b1fb6f8caae622c8b0d9bf8056fa10e2edec4a6c0b7cb59e00554ab1d515",
      "is_default_pdf": true
    },
    {
      "url": "https://opencryptology.org/2023/1261/versions/20250215T202939Z.pdf",
      "captured_at": "2025-02-15T20:29:39Z",
      "label": "copy captured 2025-02-15",
      "source": "wayback",
      "source_url": "https://web.archive.org/web/20250215202939id_/https://eprint.iacr.org/2023/1261.pdf",
      "size": 736329,
      "sha256": "0c449eb3fb9019f3a9e155784f830097ce068451d581b37a5b4bca13d043f083",
      "is_default_pdf": false
    },
    {
      "url": "https://opencryptology.org/2023/1261/versions/20240415T015642Z.pdf",
      "captured_at": "2024-04-15T01:56:42Z",
      "label": "copy captured 2024-04-15",
      "source": "wayback",
      "source_url": "https://web.archive.org/web/20240415015642id_/https://eprint.iacr.org/2023/1261.pdf",
      "size": 736304,
      "sha256": "b620633a88348f038dc6ab8b66adbe5d8446f67b5fb285794e0d38ea2de7afd5",
      "is_default_pdf": false
    },
    {
      "url": "https://opencryptology.org/2023/1261/versions/20231222T150432Z.pdf",
      "captured_at": "2023-12-22T15:04:32Z",
      "label": "copy captured 2023-12-22",
      "source": "wayback",
      "source_url": "https://web.archive.org/web/20231222150432id_/https://eprint.iacr.org/2023/1261.pdf",
      "size": 736165,
      "sha256": "e4c0760bf9f4efcd3694d4f77398081328de42518628b685f402120b676fc499",
      "is_default_pdf": false
    }
  ],
  "other_sources": [
    {
      "kind": "github-mirror",
      "url": "https://raw.githubusercontent.com/arturo-kong/IACR-eprint-mirror/master/2023/1261.pdf",
      "captured_at": "2026-04-28T17:20:00Z",
      "size": 736473
    },
    {
      "kind": "wayback",
      "url": "https://web.archive.org/web/20251012154948id_/https://eprint.iacr.org/2023/1261.pdf",
      "captured_at": "2025-10-12T15:49:48Z",
      "size": 707603
    }
  ],
  "bibtex": "@misc{cryptoeprint:2023/1261,\n      author = {Diego F. Aranha and Benjamin Salling Hvass and Bas Spitters and Mehdi Tibouchi},\n      title = {Faster constant-time evaluation of the Kronecker symbol with application to elliptic curve hashing},\n      howpublished = {Cryptology {ePrint} Archive, Paper 2023/1261},\n      year = {2023},\n      url = {https://eprint.iacr.org/2023/1261}\n}"
}
