Siacoin/Sia — pull request #96 by DavidVorick (2014-05-01 07:19:07+00:00)
Title: Remove libsodium, replace with golang standard library crypto

Sorry about all the awful commits. Still trying to break the habit.

Libsodium was causing some nasty seg faults. This is really bad for a crypto library to be doing, and it doesn't bode well for the project as a whole. So I've switched to the golang standard crypto library, which makes me sad in some ways but the show must go on.

A consequence of switching libraries is that our crypto functions are now a lot more modular, and it should be pretty easy to pop in a new crypto library (just fill out all of the functions and you should be good to go).

Another huge change is that all of the marshalling was switched to gob. While gob doesn't necessarily port to other languages, I think that this was a very good move. Gob is a powerful package with many features and it's made marshalling a ton easier, while still being efficient. Marshalling is also now substantially more modular.

Most of the cgo has been replaced, a result of ditching the crypto libraries. There is still cgo for common/erasure however.

Changes:

+ remove libsodium folder and submodule
+ switch from hardcoded K values to using `k-2` for tests
+ switch constants for quorum size to 4. This is for testing and early stage demos. It will go up as we add more quorum features back in. Step duration reduced to 3 seconds. Again this is just because most testing is done locally at this point, it's not a permanent change but I've decided to merge it into master.
+ Fix the ghost seg-fault caused by the crypto libraries, purged libsodium for having segfault issues
+ Add a compare function for public keys
+ All marshalling now uses gob
+ crypto.RandInt now works slightly differently. WARNING: breaks compatibility (I checked, I'm pretty sure I fixed every function that used RandInt before)
+ added in a bunch of testing that was previously commented out for having broken compatibility
+ added a compare function for certain structs.
+ demo is functional and doesn't have any known errors

- still no CheckKeys() function
- not all tests have been updated