Refactor Ed25519

I don't have a lost of test cases to work with, but I think I have preserved the correct behaviour here.  Let me know if that is not the case.

These changes clean up, and make much safer, assumptions in the C bindings for the Ed25519 module.  In testing, the nondeterministic behaviour of `ed25519_publickey` seems to be fixed.

I have tried to preserve style (except for obvious mistakes, such as extra `do`s that had no effect).  Let me know if you would like anything changed stylistically.