Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: luv2drnkbr on November 26, 2014, 08:43:12 PM



Title: 0x00 prefix for R and S values in DER signature
Post by: luv2drnkbr on November 26, 2014, 08:43:12 PM
I've noticed that some scriptsigs have a 0x00 prefixing the 32 byte R and S values in the signatures, and some signatures do not have that.  I was hoping somebody knows the reason behind that and can explain to me if and when the prefix is necessary, and why.


Title: Re: 0x00 prefix for R and S values in DER signature
Post by: Pieter Wuille on November 26, 2014, 11:42:39 PM
It's a DER requirement to prefix a 0x00 byte to an encoded integer if the integer otherwise starts with a byte >= 0x80. If not, it would be interpreted as a negative number.


Title: Re: 0x00 prefix for R and S values in DER signature
Post by: luv2drnkbr on November 27, 2014, 01:18:57 AM
Thanks for that clear explanation!