Post
Topic
Board Development & Technical Discussion
Re: How to convert High-S value to Low-S value?
by
Fellane
on 06/08/2020, 21:47:39 UTC
divide s by N-s ?
Not quite. You simply make s equal to N-s.

If s is greater than N/2, then you would replace s with -s. Since we are using modular arthimetic, -s becomes N-s.

Here's the relevant text from BIP62:

The value S in signatures must be between 0x1 and 0x7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF 5D576E73 57A4501D DFE92F46 681B20A0 (inclusive). If S is too high, simply replace it by S' = 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141 - S.

How do I replace it? I don’t get it. Is there step by step tutorial? My S value doesn’t look like anything like what your just sent.