To/from buffer/hex

This ports the recent changes by @dcousens from bitcoinjs-lib back to bigi. See https://github.com/bitcoinjs/bitcoinjs-lib/pull/150 for relevant discussions.