AntonKueltz / fastecdsa

Python library for fast elliptic curve crypto
https://pypi.python.org/pypi/fastecdsa
The Unlicense
264 stars 77 forks source link

Cutomize curve without p value #42

Closed hasuwasu closed 4 years ago

hasuwasu commented 4 years ago

Hi!

I saw a similar question was asked, but I'm trying to generate a custom Curve() with my own parameters and I can't find how to exclude p value since I'm using y^2 = x^3 + 7 (NIST256P) and I don't need the modulus. I looked through the official documentation but didn't see anything that answered this question. My only thought was to make p a huge value, but I'm sure there's a better way.

AntonKueltz commented 4 years ago

What are you trying to do? If you’re working with numbers that are comparable in size to what one normally would use in a cryptographic context your x and y values are going to get REALLY big very quickly given what you propose. Meaning so big you can’t do efficient computations with them.

hasuwasu commented 4 years ago

I want to create my own curve to test against data I'm given for a CTF challenge. I'm given the curve, the generator points x & y, the group order, another point x & y, the public key, & two messages with their sigantures one which does not have the first part of the signature. I want to create a NIST256P curve using the init function to test outputs but I don't want to use p in the function. I'm still learning ecc so I apologize if my explanation isn't very clear. Edit I got an explanation from a friend. I understand now what you mean by the REALLY big numbers by excluding the mod. I think my previous question should be directed to another forum. Edit 2 I apologize, I think I got it. I'm supposed to use the size of the key as the p value so 2^256. I was confused because I saw an example showing this curve as y^2 = x^3 + 7 but the mod 2^256 should be at the end regardless.

AntonKueltz commented 4 years ago

Yes, the mod p is sometimes left out of the equation, many places just assume all operations are done in the field with characteristic p, which can lead to confusion. Glad you were able to get clarification on your initial issue.