-2

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?

1 Answers1

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

RedGrittyBrick
  • 24,039
  • 3
  • 23
  • 47