function sign(transaction, privateKey, sighashType, inputIndex, subscript) {
  let hashbuf = sighash(transaction, sighashType, inputIndex, subscript);
  const sig = ECDSA.sign(hashbuf, privateKey, { endian: 'little' });
  sig.nhashtype = sighashType;
  return sig;
}
Create a signature

@name Signing.sign
@param {Transaction} transaction
@param {PrivateKey} privateKey
@param {number} sighash
@param {number} inputIndex
@param {Script} subscript
@return {Signature}