<p>It is the hash type, in this case it is <a href="https://bitcoin.org/en/glossary/sighash-all" rel="nofollow">SIGHASH_ALL</a>. To verify the digital signature inside of the Script language, it is required to have a hash type appended to the end of the digital signature. However if you verifying the signature using something like openssl, the bitcore signature would be valid. </p>

CC BY-SA 3.0
2016-08-21T08:30:39.167Z
thanks. Does it imply that using openssl to check the signature, we don't need to know about the hash type?
hartmut
CC BY-SA 3.0
2016-08-21T11:18:30.363Z
@hartmut That's right. OpenSSL only checks the DER signature. Byte 2 of the DER is the signature length (i.e. No hashcode)
Wizard Of Ozzie
CC BY-SA 3.0
2016-08-21T14:18:19.193Z
@WizardOfOzzie  Ok thanks. If you have any link you can recommend for me to read on that please feel free to post them :).
hartmut
CC BY-SA 3.0
2016-08-20T22:13:14.980Z
2016-08-20T22:13:14.980Z
Chris Stewart
<p>In bitcore-lib, the sighash type is added when building the input script (scriptSig) for the transaction, for example here: <a href="https://github.com/bitpay/bitcore-lib/blob/9e82395e71f8c1a9d4b1e4e4fc2b90085d5443d9/lib/script/script.js#L865-L886" rel="nofollow">https://github.com/bitpay/bitcore-lib/blob/9e82395e71f8c1a9d4b1e4e4fc2b90085d5443d9/lib/script/script.js#L865-L886</a></p>

<p>As well as with the <code>toTxFormat</code> method: <a href="https://github.com/bitpay/bitcore-lib/blob/764aa6d4e9f28969192db2e8c1c82326cdbb6a6b/lib/crypto/signature.js#L300-L305" rel="nofollow">https://github.com/bitpay/bitcore-lib/blob/764aa6d4e9f28969192db2e8c1c82326cdbb6a6b/lib/crypto/signature.js#L300-L305</a></p>

CC BY-SA 3.0
2016-08-22T17:24:58.323Z
Thanks! Together with http://bitcoin.stackexchange.com/questions/37125/how-are-sighash-flags-encoded-into-a-signature your answer helped me finally get it.
hartmut
CC BY-SA 3.0
2016-08-22T14:17:31.860Z
2016-08-22T14:17:31.860Z
Braydon Fuller
<p>I am confused about the end marker at the end of signatures (in my case, individual sigs for a Tx that spends a P2SH) in <code>pybitcointools</code>:</p>

<blockquote>
  <p><code>pybitcointools</code>:
  304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd<strong>01</strong></p>
  
  <p><code>Bitcore</code>: 
  304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd</p>
</blockquote>

<p>These are two same signatures (i.e., same Tx, input, private key). Only, in <code>pybitcointools</code>' implementation, you have <strong>a 01 at the end</strong>. <strong>Why?</strong> </p>

<p>Does it perhaps have to do with the hashtype?</p>

<p>Thx</p>

<multi-signature><signature><bitcore><pybitcointools>
'01' at the end of signatures
hartmut
# '01' at the end of signatures

(Asked by: username_0 on 2016-08-20)

I am confused about the end marker at the end of signatures (in my case, individual sigs for a Tx that spends a P2SH) in `pybitcointools`:

> `pybitcointools`:
> 304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd**01**
>
> `Bitcore`:
> 304402204dae851c29a117383c5c535086a7fe899c9c5f0d927a4e680498fdd9b244cb15022058fea40a9f8c3988b17556fceacdce063860057fd8c6ad84de40515d287758dd

These are two same signatures (i.e., same Tx, input, private key). Only, in `pybitcointools`' implementation, you have **a 01 at the end**. **Why?**

Does it perhaps have to do with the hashtype?

Thx

**Tags:** multi-signature, signature, bitcore, pybitcointools


---

## 2 answers

### Answer by username_1 on 2016-08-20. Score: 2 | Accepted answer

It is the hash type, in this case it is [SIGHASH\_ALL](https://bitcoin.org/en/glossary/sighash-all). To verify the digital signature inside of the Script language, it is required to have a hash type appended to the end of the digital signature. However if you verifying the signature using something like openssl, the bitcore signature would be valid.

> **Comments:**
> **username_0**: thanks. Does it imply that using openssl to check the signature, we don't need to know about the hash type?  
> **username_2**: @username_0 That's right. OpenSSL only checks the DER signature. Byte 2 of the DER is the signature length (i.e. No hashcode)  
> **username_0**: @username_2  Ok thanks. If you have any link you can recommend for me to read on that please feel free to post them :).  

---

### Answer by username_3 on 2016-08-22. Score: 1

In bitcore-lib, the sighash type is added when building the input script (scriptSig) for the transaction, for example here: <https://github.com/bitpay/bitcore-lib/blob/9e82395e71f8c1a9d4b1e4e4fc2b90085d5443d9/lib/script/script.js#L865-L886>

As well as with the `toTxFormat` method: <https://github.com/bitpay/bitcore-lib/blob/764aa6d4e9f28969192db2e8c1c82326cdbb6a6b/lib/crypto/signature.js#L300-L305>

> **Comments:**
> **username_0**: Thanks! Together with http://bitcoin.stackexchange.com/questions/37125/how-are-sighash-flags-encoded-into-a-signature your answer helped me finally get it.  

---

