1

I apologise for asking a possibly trivial question. I am not much of a programmer and that's my problem.

In an answer to another question about obtaining the Bitcoin address from a private key the following is stated:

A Bitcoin address is computed as follows:

  1. A private key is a 256-bit integer $k$ below 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141, the order of the group $E(\mathbb F_p)$ of $\mathbb F_p$-rational points on the curve [secp256k1], $E/\mathbb F_p: y^2 = x^3 + 7$ where $p$ is the prime $2^{256} - 2^{32} - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1$.

  2. A public key is the standard encoding $\underline P$ of a point $P = [k]B$ on secp256k1, the scalar multiplication by $k$ of the standard base point $B \in E(\mathbb F_p)$.

  3. An address is the ‘base58’ encoding of the string $\text{‘1’} \mathbin\Vert h \mathbin\Vert c$, where $h = \operatorname{RIPEMD160}(\operatorname{SHA256}(\underline P))$ and $c$ is the first four bytes of $\operatorname{SHA256}(\operatorname{SHA256}(\text{‘1’} \mathbin\Vert h))$.

My question is is there trusted/audited code (preferably in a high level language such as pari/gp, magma, sage, but not necessarily) that can be run on a local computer (not online) for testing that a bitcoin address corresponds to a certain private key.

Any pointers appreciated. I suppose there are github pages containing such code, but again, I am unable to judge such code as being correct. For example the code would need to do the standard encodings in the relevant algebraic structures.

Another relevant question, which was pointed out in the comments under this question is this one.

kodlu
  • 25,146
  • 2
  • 30
  • 63

0 Answers0