# Question regarding of the ECC test vector format

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
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?

• Is your confusion why there is a different combination of hex and decimal representations? The scalar and the coordinates of the point are all integers, how you represent them is up to whoever wrote the test vectors. Hex and decimal are equally acceptable representations (hex is slightly more compact). – puzzlepalace Jun 6 '19 at 2:58
• Yes, I just edit a bit again to clarify my questions. for secp256k1, does the 256 means the key storage hex format legth? and some other curve like BP-521, does that mean the key bit lenth is 521b (which refer to hex format but not decimal format)? – LeonMSH Jun 6 '19 at 5:25
• @puzzlepalace I convert above the big decimal number k to hex format, it is indeed 32byte long. So are those "standard curve" used in ECC, they all request the key (private and public coordination x, y) to be less than a largest number, for instance curve 256k1/256r1, the key must be smaller than (2^256-1)? – LeonMSH Jun 7 '19 at 8:50

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}$$.

• great thanks. I still need time to study the mathematics behind these. The reason that I asked these question is that I need locate some memory in C code for these key storage (which are usually large number) , so need know the exactly byte or bit size to be allocate in advanced. so far I can allocate 32byte (hex off- cause) to X/Y/m(ork) for p-256k1 and p-256r1, but for P-521 (yes should be P-521, not BP-521), looks I have to do some special process. – LeonMSH Jun 13 '19 at 8:39