Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

Are there any available test cases for testing elliptic curves like secp256k1 (Korblitz curves from http://www.secg.org/collateral/sec2_final.pdf)? For curves like P192 there are for example those values: http://point-at-infinity.org/ecc/nisttv .

Moreover, what other ways one should test an implementation of an elliptic curve to make sure it is working correctly in all the scenarios used in encryption software?

Are there any easy to understand examples/tutorials of how to program and test elliptic curve algorithms that are available online?

share|improve this question

1 Answer 1

up vote 12 down vote accepted

Here are five test vectors for secp256k1, which I just generated with my own code. My code is a generic implementation of elliptic curves; it has been tested for many curves for which test vectors were available (in particular the NIST curves) so I tend to believe that it is correct. Each test vector is a value $m$ (chosen randomly modulo the curve order $n$) and the coordinates $(X, Y)$ of the point $mG$, where $G$ is the conventional generator defined in section 2.7.1 of SEC 2.

m = AA5E28D6A97A2479A65527F7290311A3624D4CC0FA1578598EE3C2613BF99522
X = 34F9460F0E4F08393D192B3C5133A6BA099AA0AD9FD54EBCCFACDFA239FF49C6
Y = 0B71EA9BD730FD8923F6D25A7A91E7DD7728A960686CB5A901BB419E0F2CA232

m = 7E2B897B8CEBC6361663AD410835639826D590F393D90A9538881735256DFAE3
X = D74BF844B0862475103D96A611CF2D898447E288D34B360BC885CB8CE7C00575
Y = 131C670D414C4546B88AC3FF664611B1C38CEB1C21D76369D7A7A0969D61D97D

m = 6461E6DF0FE7DFD05329F41BF771B86578143D4DD1F7866FB4CA7E97C5FA945D
X = E8AECC370AEDD953483719A116711963CE201AC3EB21D3F3257BB48668C6A72F
Y = C25CAF2F0EBA1DDB2F0F3F47866299EF907867B7D27E95B3873BF98397B24EE1

m = 376A3A2CDCD12581EFFF13EE4AD44C4044B8A0524C42422A7E1E181E4DEECCEC
X = 14890E61FCD4B0BD92E5B36C81372CA6FED471EF3AA60A3E415EE4FE987DABA1
Y = 297B858D9F752AB42D3BCA67EE0EB6DCD1C2B7B0DBE23397E66ADC272263F982

m = 1B22644A7BE026548810C378D0B2994EEFA6D2B9881803CB02CEFF865287D1B9
X = F73C65EAD01C5126F28F442D087689BFA08E12763E0CEC1D35B01751FD735ED3
Y = F449A8376906482A84ED01479BD18882B919C140D638307F0C0934BA12590BDE

For self-testing an elliptic curve implementation, I suggest first verifying that multiplying $G$ by $n$ (the expected curve order) indeed yields the point at infinity. Then, do the following many times:

  • Choose two random integers modulo $n$; call them $a$ and $b$.
  • Compute $c = a + b$.
  • Compute points $P = aG$, $Q = bG$ and $R = cG$.
  • Verify that $P + Q = Q + P = R$.

If you go through this a few dozen times with no errors then chances are that your implementation is at least mostly correct.

A must-have reference on elliptic curve implementation is the Guide to Elliptic Curve Cryptography. It is not free, but worth its price. Good university libraries will let you read it without spending a dime on it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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