<blockquote>
  <p>I think maybe this one?: <code>800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D</code></p>
</blockquote>

<p>Yep!</p>

<blockquote>
  <p>and I don't know how to convert its bytes to a "big integer" (keep in mind that I'm trying to learn and therefore need to do all of the math myself instead of simply having an existing programming command or web tool do it for me).</p>
</blockquote>

<p>First, you need to convert it to an integer. Let me give you a simple example that you can use to test your program:</p>

<pre><code>hex = fb4d9a
dec = 16469402
</code></pre>

<p>How do you get an integer from hex? It's like reading a base ten number, only it's base 16.</p>

<pre><code>hex = fb4d9a
           ^ one's column
          ^ 16's column
         ^ 256's column (16*16)
        ^ etc.
</code></pre>

<p>Once you figure this out, upgrade your program to handle 'big integers.' Some programming languages have a limit on how big of numbers they can handle. In C, you can't put five billion into an <code>int</code> type variable. Some languages, like Python, can handle big integers without any help.</p>

<p>The number you get for the hash you referenced should be <code>63680997318088143281752740767766707563546963464218564507450892460763521488675430192536461</code>.</p>

<blockquote>
  <p>I'm not sure what "hash" it's referring to.</p>
</blockquote>

<p>It's the same one you just referenced. In this case, there are zero leading zeroes, which means that the output address should not start with a one.</p>

CC BY-SA 3.0
2017-09-29T09:31:29.407Z
What a great answer. Thanks so much! Got it all figured out now, and even have my own handy dandy Bitcoin wallet generator!
Eric Glass
CC BY-SA 3.0
2017-09-29T06:50:26.163Z
2017-09-29T06:50:26.163Z
Nick ODell
<p>I'm trying to learn every bit of the process of converting a private key to WIF (Wallet Import Format).<br>
I've been following the steps on <a href="https://en.bitcoin.it/wiki/Wallet_import_format" rel="nofollow noreferrer">this page</a> and have made it all the way to the last step (Step 7 - <em>"Convert the result from a byte string into a base58 string using Base58Check encoding"</em>) and that's where I'm stuck.<br>
I need to use this process:</p>

<pre><code>   code_string = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
   x = convert_bytes_to_big_integer(hash_result)

   output_string = ""

   while(x &gt; 0) 
       {
           (x, remainder) = divide(x, 58)
           output_string.append(code_string[remainder])
       }

   repeat(number_of_leading_zero_bytes_in_hash)
       {
       output_string.append(code_string[0]);
       }

   output_string.reverse();
</code></pre>

<p>That process is from the <a href="https://en.bitcoin.it/wiki/Base58Check_encoding" rel="nofollow noreferrer">Bitcoin wiki</a>.<br>
I'm pretty sure I've managed to decipher all of it except for this part:  </p>

<pre><code>x = convert_bytes_to_big_integer(hash_result)
</code></pre>

<p>It looks like its telling me to convert the bytes of a hash result into a "big integer", but I'm not sure what hash result it's referring to (I think maybe this one?: <code>800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D</code>) and I don't know how to convert its bytes to a "big integer" (keep in mind that I'm trying to learn and therefore need to do all of the math myself instead of simply having an existing programming command or web tool do it for me).  </p>

<p>And to a lesser extent this part:  </p>

<pre><code>repeat(number_of_leading_zero_bytes_in_hash)
</code></pre>

<p>I'm not sure what "hash" it's referring to.</p>

<p>I've spent many hours trying to figure all this out and have done a lot of searching and tried many possible interpretations so please don't think I'm just looking for someone to do the work for me.<br>
Thank you.</p>

<base58>
Convert byte string into a base58 string using Base58Check encoding
Eric Glass
# Convert byte string into a base58 string using Base58Check encoding

(Asked by: username_0 on 2017-09-29)

I'm trying to learn every bit of the process of converting a private key to WIF (Wallet Import Format).  
I've been following the steps on [this page](https://en.bitcoin.it/wiki/Wallet_import_format) and have made it all the way to the last step (Step 7 - *"Convert the result from a byte string into a base58 string using Base58Check encoding"*) and that's where I'm stuck.  
I need to use this process:

```
   code_string = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
   x = convert_bytes_to_big_integer(hash_result)

   output_string = ""

   while(x > 0) 
       {
           (x, remainder) = divide(x, 58)
           output_string.append(code_string[remainder])
       }

   repeat(number_of_leading_zero_bytes_in_hash)
       {
       output_string.append(code_string[0]);
       }

   output_string.reverse();

```

That process is from the [Bitcoin wiki](https://en.bitcoin.it/wiki/Base58Check_encoding).  
I'm pretty sure I've managed to decipher all of it except for this part:

```
x = convert_bytes_to_big_integer(hash_result)

```

It looks like its telling me to convert the bytes of a hash result into a "big integer", but I'm not sure what hash result it's referring to (I think maybe this one?: `800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D`) and I don't know how to convert its bytes to a "big integer" (keep in mind that I'm trying to learn and therefore need to do all of the math myself instead of simply having an existing programming command or web tool do it for me).

And to a lesser extent this part:

```
repeat(number_of_leading_zero_bytes_in_hash)

```

I'm not sure what "hash" it's referring to.

I've spent many hours trying to figure all this out and have done a lot of searching and tried many possible interpretations so please don't think I'm just looking for someone to do the work for me.  
Thank you.

**Tags:** base58


---

## 1 answers

### Answer by username_1 on 2017-09-29. Score: 1 | Accepted answer

> I think maybe this one?: `800C28FCA386C7A227600B2FE50B7CAE11EC86D3BF1FBE471BE89827E19D72AA1D507A5B8D`

Yep!

> and I don't know how to convert its bytes to a "big integer" (keep in mind that I'm trying to learn and therefore need to do all of the math myself instead of simply having an existing programming command or web tool do it for me).

First, you need to convert it to an integer. Let me give you a simple example that you can use to test your program:

```
hex = fb4d9a
dec = 16469402

```

How do you get an integer from hex? It's like reading a base ten number, only it's base 16.

```
hex = fb4d9a
           ^ one's column
          ^ 16's column
         ^ 256's column (16*16)
        ^ etc.

```

Once you figure this out, upgrade your program to handle 'big integers.' Some programming languages have a limit on how big of numbers they can handle. In C, you can't put five billion into an `int` type variable. Some languages, like Python, can handle big integers without any help.

The number you get for the hash you referenced should be `63680997318088143281752740767766707563546963464218564507450892460763521488675430192536461`.

> I'm not sure what "hash" it's referring to.

It's the same one you just referenced. In this case, there are zero leading zeroes, which means that the output address should not start with a one.

> **Comments:**
> **username_0**: What a great answer. Thanks so much! Got it all figured out now, and even have my own handy dandy Bitcoin wallet generator!  

---

