Sign the entire script input

Added a helper function for signing script inputs. Also, the entire script input is now signed. This means that the default script can be modified to read opcodes from inside the signed message, instead of appending the original input to the signed message.