0
$\begingroup$

Given a d value = -(10240/10241)

How would I convert this into 64 bit limbs?

I have to expand on this because of stackoverflow quality algorithm, I've tried using python to get the integer rep/hex rep, but it's not a whole number, so I'm a bit lost

$\endgroup$
4
  • $\begingroup$ What field are we working in? $\endgroup$ – Squeamish Ossifrage Apr 28 '19 at 16:01
  • $\begingroup$ Any field, just want to see the process @SqueamishOssifrage $\endgroup$ – WeCanBeFriends Apr 28 '19 at 16:03
  • 1
    $\begingroup$ Well, if you're talking about the rational numbers, it depends on how you encode them: as numerator/denominator fractions? as fixed-point? as floating-point? If you're talking about finite fields, look up modular multiplicative inverses. $\endgroup$ – Squeamish Ossifrage Apr 28 '19 at 16:05
  • 1
    $\begingroup$ Trying to look up if this was about crypto (didn't hear about limbs before, I guess we normally just use "words"), I found this presentation Could you take a look at page 7 to see if it answers your question? $\endgroup$ – Maarten Bodewes Apr 28 '19 at 22:58
1
$\begingroup$

Assuming that this is related to the Jubjub Edwards curve, for which d = -(10240/10241) (mod r = 52435875175126190479447740508185965837690552500527637822603658699938581184513) = 19257038036680949359750312669786877991949435402254120286184196891950884077233, the four 64-bit limbs (in little-endian order) are:

(73851820219580081, 2967167836563676454, 17725484271033745364, 3067823152860638024)

The "process" is pretty simple:

  • 73851820219580081 = d mod 2^64
  • 2967167836563676454 = (d / 2^64) mod 2^64
  • 17725484271033745364 = (d / 2^128) mod 2^64
  • 3067823152860638024 = (d / 2^192) mod 2^64
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.