<p>I may have misunderstood what you want but maybe this helps?</p>
<p>I believe both R and S are 32-Byte integers that are typically shown as hexadecimal strings.</p>
<p>I believe Z is a double SHA256 hash result - which is also a 32-Byte integer typically displayed as a hexadecimal string.</p>
<p>How you convert a hexadecimal string to an integer depends on what tools you are using.</p>
<p>Sometimes you need to convert between little-endian and big-endian. There are many ways to do this.</p>
<p>For example, a programmer using the Go programming language might do something like</p>
<pre><code>package main

import (
    &quot;fmt&quot;
    &quot;math/big&quot;
)

func main() {
    zHex := &quot;46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3&quot;
    Convert(zHex)
    fmt.Print(&quot;Reversed &quot;)
    Convert(ReverseHexString(zHex))
}

// Converting a hexadecimal string to integer, display as decimal and hex
func Convert(x string) {
    fmt.Println(&quot;Hex string is &quot;, x)
    z := new(big.Int)    // *********** AN INTEGER **********
    z.SetString(x, 16)
    fmt.Println(&quot;Z in decimal is &quot;, z)
    fmt.Printf(&quot;Z in hex is %x\n\n&quot;, z)
}

// construct reversed hex string
func ReverseHexString(x string) string {
    // Not meant to be efficient. Breaks if runes not Basic-Latin.
    l := len(x)
    if l%2 &gt; 0 {
        l++
        x = &quot;0&quot; + x
    }
    r := make([]byte, l)
    for i := 0; i &lt; l-1; i += 2 {
        j := l - i - 2
        r[j] = x[i]
        r[j+1] = x[i+1]
    }
    return string(r)
}
</code></pre>
<p>See <a href="https://go.dev/play/p/tPr0EhpUrZ1" rel="nofollow noreferrer">this in Go Playground</a></p>
<p>Which outputs</p>
<pre><code>Hex string is  46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3
Z in decimal is  31982429910343551848810458726972456231796402437722377314466757517403166514915
Z in hex is 46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3

Reversed Hex string is  e39e32fc55c5cef26e29e78205ab4a970430c6981ee9ffc9c682ae5ff169b546
Z in decimal is  102954530354893272977241718733779284938475056689506134562699941665017241908550
Z in hex is e39e32fc55c5cef26e29e78205ab4a970430c6981ee9ffc9c682ae5ff169b546
</code></pre>
<hr />
<p>See also</p>
<ul>
<li><a href="https://bitcoin.stackexchange.com/q/93711/13866">How do I to get the r, S and Z values from a raw transaction (version 2)</a></li>
</ul>

CC BY-SA 4.0
2022-09-24T21:30:03.363Z
2022-09-24T21:37:58.330Z
2022-09-24T21:37:58.330Z
RedGrittyBrick
<p>how do I convert the given raw values in RSZ and Hash to integer?</p>
<p>Is there an online convertor or a script I can use?</p>

<attack>
Convert raw values to Int
Roy Nahar
# Convert raw values to Int

(Asked by: username_0 on 2022-09-24)

how do I convert the given raw values in RSZ and Hash to integer?

Is there an online convertor or a script I can use?

**Tags:** attack


---

## 1 answers

### Answer by username_1 on 2022-09-24. Score: 0

I may have misunderstood what you want but maybe this helps?
I believe both R and S are 32-Byte integers that are typically shown as hexadecimal strings.
I believe Z is a double SHA256 hash result - which is also a 32-Byte integer typically displayed as a hexadecimal string.
How you convert a hexadecimal string to an integer depends on what tools you are using.
Sometimes you need to convert between little-endian and big-endian. There are many ways to do this.
For example, a programmer using the Go programming language might do something like
package main

import (
    "fmt"
    "math/big"
)

func main() {
    zHex := "46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3"
    Convert(zHex)
    fmt.Print("Reversed ")
    Convert(ReverseHexString(zHex))
}

// Converting a hexadecimal string to integer, display as decimal and hex
func Convert(x string) {
    fmt.Println("Hex string is ", x)
    z := new(big.Int)    // *********** AN INTEGER **********
    z.SetString(x, 16)
    fmt.Println("Z in decimal is ", z)
    fmt.Printf("Z in hex is %x\n\n", z)
}

// construct reversed hex string
func ReverseHexString(x string) string {
    // Not meant to be efficient. Breaks if runes not Basic-Latin.
    l := len(x)
    if l%2 > 0 {
        l++
        x = "0" + x
    }
    r := make([]byte, l)
    for i := 0; i < l-1; i += 2 {
        j := l - i - 2
        r[j] = x[i]
        r[j+1] = x[i+1]
    }
    return string(r)
}

See this in Go Playground
Which outputs
Hex string is  46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3
Z in decimal is  31982429910343551848810458726972456231796402437722377314466757517403166514915
Z in hex is 46b569f15fae82c6c9ffe91e98c63004974aab0582e7296ef2cec555fc329ee3

Reversed Hex string is  e39e32fc55c5cef26e29e78205ab4a970430c6981ee9ffc9c682ae5ff169b546
Z in decimal is  102954530354893272977241718733779284938475056689506134562699941665017241908550
Z in hex is e39e32fc55c5cef26e29e78205ab4a970430c6981ee9ffc9c682ae5ff169b546


See also

How do I to get the r, S and Z values from a raw transaction (version 2)


---

