# Thread: Elliptic Curve Implementation using NTL library in C++ [Problem]

1. ## Elliptic Curve Implementation using NTL library in C++ [Problem]

This is in no way related to any shady business like keygenning any commercial software.

I love working on writing softwares & cryptography.
I've used NTL library to write my own ECC functions & tested them using certicoms example.

How ever when I wrote a ECDSA_Sign()[Elliptic Curve Digital Signature algorithm]
using my procs, NTL started behaving irratic.

I would like to get some assistance on this.

br
KKR

2. Ewww - ECC.rar (10.2 MB)
1. It's 10MB
2. It's RAR

1. Strip out all executables, object files, symbol tables, crash dumps, project files and any other stuff which can be recreated by doing a 'make' or 'rebuild all'
2. Not everyone has rar

You should try and generate a small complete example which demonstrates your specific problem. Ie, something where you can ask a specific question and we can look at a small amount of code in hopefully a small amount of time (which is given freely I might add).

A side benefit of attempting to produce a small complete example is that you might actually figure out what you did wrong to begin with the first time around. In which case, you already have your answer (and a handy technique to help you in future).

You're looking at days of solid commitment from someone to look at that monster!

3. hehe.. sry.. I'll also attach the .cpp file.
But the thing only has the code required for the thing to work properly.

But you will need the ntl static library to be able to compile it.

Thats why I've attached the enitre thing.

But here is the .cpp file.

Attachment 10344

Hope this helps. & as far as the problem goes, while running the ECDSA code, the NTL lib does stupid things like - after a mod operation the value is negative.
This negative val remains negative even after
if (val < 0)
{
val = prime + val;
}

This results in a malfunctioning of the InvMod() function as it doesn't take a negative number as the 1st param.

But surprisingly, the code works with the small example params which are in certicom website.

This is what confused the hell out of me

br
KKR