Some bug fixes and other proposals for better compatibility between bignum and cipher

Hi Adam:

Here's the pull request. I have separated it in several commits so that you can see the intent of each change. Some are bug fixes and others are a proposal to make cipher and bignum more compatible. You may or may not agree with them so feel free to discuss them with me.

Regarding bug fixes I've done some dirty patching just to make it work but I'm pretty sure that they are not the best solutions. Perhaps if you see what I needed to do you can figure out what was wrong with your implementation.

Hope you like it ;-).