Fixed weak param check, better variable names

Would have crashed on empty string.
Hide some private constants
Prime char is now a plain C character
Assert internal methods
Explicit sighash flags during the signing process

Flexible methods will help later with multisignature.