<p>Yes, the sighash type can be other than 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, and 0x83, but it can't be values like 1190874345 or -886562767. You will see these in the tests because of the specific functions being tested, but those sighash types will not work in actual transactions.</p>

<p>In actual transactions, the sighash type is the last byte of the signature item. Because it is one byte, there are only 256 possible sighash type values. However, in creating the sighash (and the functions that create that) take a signed int which is 4 bytes. So the unit tests for that function use valid values for the function but those are not valid in transactions.</p>

<p>So in actual transactions, you can use other sighash types. How they behave is a little hard to describe. Confusingly, sometimes the sighash type is treated as a bit set, and other times, as an int.</p>

<p>If the eigth bit (most significant bit) is set, then the SIGHASH_ANYONECANPAY behavior will apply. If taking just the first 5 bits is equal to 2, then SIGHASH_NONE behavior applies. And if taking just the first 5 bits is equal to 3, then SIGHASH_SINGLE behavior applies. All values that do not meet these requirements (which includes the default SIGHASH_ALL 0x01) all mean to use the SIGHASH_ALL rules.</p>

CC BY-SA 4.0
2020-06-07T07:26:04.640Z
2020-06-07T07:26:04.640Z
Ava Chow
<p>As per hashtype value in <a href="https://en.bitcoin.it/wiki/OP_CHECKSIG" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/OP_CHECKSIG</a> or <a href="https://developer.bitcoin.org/devguide/transactions.html#signature-hash-types" rel="nofollow noreferrer">https://developer.bitcoin.org/devguide/transactions.html#signature-hash-types</a>, hashtype could either be 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83.</p>
<p>However, looking at bitcoin testing data in <a href="https://github.com/bitcoin/bitcoin/blob/452bb90c718da18a79bfad50ff9b7d1c8f1b4aa3/src/test/data/sighash.json" rel="nofollow noreferrer">https://github.com/bitcoin/bitcoin/blob/452bb90c718da18a79bfad50ff9b7d1c8f1b4aa3/src/test/data/sighash.json</a>, the hashtype could be in many other value such 1190874345 or -886562767 or other numerical value</p>

<bitcoin-core><wallet><signature><input-script>
Can hashtype in BTC scriptSig contained value other than 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83?
brianinhk
# Can hashtype in BTC scriptSig contained value other than 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83?

(Asked by: username_0 on 2020-06-07)

As per hashtype value in <https://en.bitcoin.it/wiki/OP_CHECKSIG> or <https://developer.bitcoin.org/devguide/transactions.html#signature-hash-types>, hashtype could either be 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83.

However, looking at bitcoin testing data in <https://github.com/bitcoin/bitcoin/blob/452bb90c718da18a79bfad50ff9b7d1c8f1b4aa3/src/test/data/sighash.json>, the hashtype could be in many other value such 1190874345 or -886562767 or other numerical value

**Tags:** bitcoin-core, wallet, signature, input-script


---

## 1 answers

### Answer by username_1 on 2020-06-07. Score: 2 | Accepted answer

Yes, the sighash type can be other than 0x01, 0x02, 0x03, 0x80, 0x81, 0x82, and 0x83, but it can't be values like 1190874345 or -886562767. You will see these in the tests because of the specific functions being tested, but those sighash types will not work in actual transactions.

In actual transactions, the sighash type is the last byte of the signature item. Because it is one byte, there are only 256 possible sighash type values. However, in creating the sighash (and the functions that create that) take a signed int which is 4 bytes. So the unit tests for that function use valid values for the function but those are not valid in transactions.

So in actual transactions, you can use other sighash types. How they behave is a little hard to describe. Confusingly, sometimes the sighash type is treated as a bit set, and other times, as an int.

If the eigth bit (most significant bit) is set, then the SIGHASH\_ANYONECANPAY behavior will apply. If taking just the first 5 bits is equal to 2, then SIGHASH\_NONE behavior applies. And if taking just the first 5 bits is equal to 3, then SIGHASH\_SINGLE behavior applies. All values that do not meet these requirements (which includes the default SIGHASH\_ALL 0x01) all mean to use the SIGHASH\_ALL rules.


---

