2
$\begingroup$

I am trying to verify an Ed25519 implementation, but I can't find any test vectors for the curve points. All test vectors focus directly on signature constructions (EdDSA).

I tried to use https://asecuritysite.com/ecc/nacl07 but that seems to give the wrong results. For instance, it reports that the affine coordinates of the point 5G are:

x = 49384254074273129950593193138861175954739393969723597783743362437597626495704

y = 100993238402330024465140605900252962566919016078863090678826226962847795431661

but that's not even on the curve... Are there any reliable, reference test vectors to validate generic operations on Ed25519?

$\endgroup$
1
  • 2
    $\begingroup$ There is already python code in the Ed25519 section Section 6 $\endgroup$
    – kelalaka
    Apr 24, 2022 at 19:42

1 Answer 1

2
$\begingroup$

Just use a reliable library to generate your test vectors. For example, using elliptic:

const elliptic = require('elliptic');
const ed25519 = new require('elliptic').eddsa('ed25519');
const BN = require('bn.js');

function printPointInfo(desc, P) {
  console.log(`${desc}: hex:     ` + elliptic.utils.toHex(ed25519.encodePoint(P)));
  console.log(`${desc}: x-coord: ` + P.getX());
  console.log(`${desc}: y-coord: ` + P.getY());
  console.log();
}

let G = ed25519.curve.g;
let a = '12581e70a192aeb9ac1411b36d11fc06393db55998190491c063807a6b4d730d';
let b = '0c2340b974bebfb9cb3f14e991bca432b57fb33f7c4d79e15f64209076afcd00';
let aG = G.mul(elliptic.utils.intFromLE(a));
let bG = G.mul(elliptic.utils.intFromLE(b));
printPointInfo('G', G);
printPointInfo('2G', G.mul(new BN(2)));
printPointInfo('5G', G.mul(new BN(5)));
printPointInfo('aG', aG);
printPointInfo('bG', bG);

Expected output:

G: hex:     5866666666666666666666666666666666666666666666666666666666666666
G: x-coord: 15112221349535400772501151409588531511454012693041857206046113283949847762202
G: y-coord: 46316835694926478169428394003475163141307993866256225615783033603165251855960

2G: hex:     c9a3f86aae465f0e56513864510f3997561fa2c9e85ea21dc2292309f3cd6022
2G: x-coord: 24727413235106541002554574571675588834622768167397638456726423682521233608206
2G: y-coord: 15549675580280190176352668710449542251549572066445060580507079593062643049417

5G: hex:     edc876d6831fd2105d0b4389ca2e283166469289146e2ce06faefe98b22548df
5G: x-coord: 33467004535436536005251147249499675200073690106659565782908757308821616914995
5G: y-coord: 43097193783671926753355113395909008640284023746042808659097434958891230611693

aG: hex:     14e35209936de59710e4a3a55b1887a6f3a390c0b1b2d132a0158ff3b60581e0
aG: x-coord: 46953515626174660128743374276590207025464948126956050456964432034683890442435
aG: y-coord: 43649996176441760651255662656482711906128939437336752974722489909985414406932

bG: hex:     cca4cc575d5eb9057834ad8b759272d37feb95c9f7197bf251814f37a4413f1d
bG: x-coord: 48108495825706412711799803692360228025391948835486250305831184019146948949994
bG: y-coord: 13228837014764440841117560545823854143168584625415590819123131242008409842892

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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