0

I am trying to find some ECC test vector for using. I just find some post (like this) and github resource (like this ) They are good reference to my C test code but I'd like to get some more advice...

Most of the test vector given looks like such format:

k (or m):m = 20
X = 0x83A01A9378395BAB9BCD6A0AD03CC56D56E6B19250465A94A234DC4C6B28DA9A
Y = 0x76E49B6DE2F73234AE6A5EB9D612B75C9F2202BB6923F54FF8240AAA86F640B8

which by my understanding, k (or m) is the private key and (X,Y) are the public key--so (X,Y)=(m dot G), G is the base point defined by NIST or BP curve as “standard”. Q1:Is such understanding correct?

It is meaningful to see the X/Y are both 32Byte for curve sepc256k1--so expect the key length would be 256b(32byte);

my question is about the privite key (denote as m or k). for some test vector, m(or k) is given as:

m = AA5E28D6A97A2479A65527F7290311A3624D4CC0FA1578598EE3C2613BF99522

some other test vector m(or k), however, would be like below:

k = 112233445566778899
k = 10
k = 57896044618658097711785492504343953926418782139537452191302581570759080747168

These are all pure number, so Q2: Does that mean we need convert them to hex--and by doing that I can get exactly 32byte test vector?

LeonMSH
  • 121
  • 7

1 Answers1

1

so (X,Y)=(m dot G), G is the base point defined by NIST or BP curve as “standard”. Q1: Is such understanding correct?

Yes, that sounds likely to be right.

Q2: Does that mean we need convert them to hex--and by doing that I can get exactly 32byte test vector?

What format your C test code handles is, well, up to your C test code. What they represent is an integer, however you choose to store it, in the scalar ring of the curve.

and some other curve like BP-521, does that mean the key bit lenth is 521b?

What BP-521 refers to, I don't know, but if it's anything like E-521 or NIST P-521, it likely refers to the size in bits of the coordinate field modulus, i.e. the field in which the coordinates $x$ and $y$ live in: the Mersenne prime $2^{521} - 1$ is convenient as a modulus for arithmetic because $2^{521} x_{\mathrm{hi}} + x_{\mathrm{lo}} \equiv x_{\mathrm{hi}} + x_{\mathrm{lo}} \pmod{2^{521} - 1}$, so a reduction step only takes a shift-and-add.

Hasse's theorem implies that the size $\ell$ of the scalar ring and the size $q$ of the coordinate field can't be much different, $|\ell - (q + 1)| \leq 2\sqrt q$, so the scalar ring modulus $\ell$ is also going to be near $q = 2^{521} - 1$ in this case but may be off by about $2^{261}$.

Squeamish Ossifrage
  • 49,816
  • 3
  • 122
  • 230