Post
Topic
Board Development & Technical Discussion
Re: Source code for ECDSA operations (key generation, signing, verifying, etc)
by
DeathAndTaxes
on 12/04/2014, 14:07:41 UTC
Cool, let me know if you have questions.

That would be a great help, it can be quite hard squeezing in time to work on projects like these! I'll flick you a pm once it's on github.

I might have jumped the gun but I got the urge to do some "fun" (non-employment) coding this morning.  To avoid you duplicating a lot of routine housework I threw it up on a quick repo. 
https://github.com/TangibleCryptography/Secp256k1

I did some very basic refactoring (breaking solution into a class library, demo, and testing projections).  Started building out some of the more basic unit tests (hashing & base58 encoding).  I already noticed some issues with signatures.   The signmessage function is returning the compressed key but the signature is based on the uncompressed key.  Most likely we are going to want a keypair class which encapsulates the full bitcoin key "logic" (private key, public key, pubkeyhash, address, etc), that will make it easier to perform signature operations without needing to explicitly ensure compressed vs uncompressed is set properly.  Before I tackle that I will be doing some more basic refactoring to use some c# language features like extension methods.  I used Nunit for testing module and it should pull it directly from Nuget if needed.  I have no problem with Visual Studio internal testing framework (or even Resharper's test framework) but I can't remember which versions of VS don't have testing support.  I figured Nunit might be more open to users of even express version of VS.

Since this is started from your code, if you wish to clone this to your github repo go ahead.  I have no problem taking this down once you have a public copy up. If you want you can give me commit access or if not I can do pull requests from your repo, all depends on how hands on you want to be.  I would recommend adding a license (COPYING) to the root of the repo.  Not sure if you have any preference, if not I am included to use modified BSD (  ).  Lastly the solution is more a lightweight bitcoin crypto library in C#, not just Secp256K1 library, so my boilerplate /Secp256k1 doesn't really describe the scope accurately so it might make sense to change that name of the solution and repo to something more fighting (and less verbose than "lightweight crypto library from bitcoin in C#").