ed25519 format
Closed this issue · 2 comments
Sorry if this is a stupid question but I couldn't find any information about this on the internet. When I read the keys generated by mkp224o I get a bunch of weird characters starting with |== ed25519v1-sec|
. I'm trying to use an external library in my program to read my Tor private key (I have a vanity address that I can't regenerate) that requires the key to be in a format similar to 7d8ce6951efa7d471f6109e3b16d1a02382fc2e01843df3ed44226c27e3a1733h
(see https://pkg.go.dev/golang.org/x/crypto/ed25519#PrivateKey). Is this still possible with mkp224o after I generated hs_ed25519_secret_key)
?
Here is an example of the private key your program generates for the address nekou3v5bnat2diaa2qovbmb5veofiphbqwdmwd7jobquhr52yrxpzyd.onion
:
0000-0010: 3d 3d 20 65-64 32 35 35-31 39 76 31-2d 73 65 63 ==.ed255 19v1-sec
0000-0020: 72 65 74 3a-20 74 79 70-65 30 20 3d-3d 00 00 00 ret:.typ e0.==...
0000-0030: 08 4d a7 f5-91 4c fb 62-e3 93 68 1a-1d 4e 6e 5d .M...L.b ..h..Nn]
0000-0040: 65 e8 6b 1f-7c 8b 1e 55-49 0a 45 eb-09 9b 72 42 e.k.|..U I.E...rB
0000-0050: 85 89 b4 c3-a4 f2 9f af-c4 20 af 50-cb 60 5b d5 ........ ...P.`[.
0000-0060: 73 a7 07 b5-5e d9 e3 00-b7 18 a3 cc-c7 9a 23 14 s...^... ......#.
We obviously have to remove the first part along with the three empty bytes (== ed25519v1-secret: type0 ==\x00\x00\x00
) so that we end up with 64 bytes. After that we can give the input to a different Tor address generator to validate whether the addresses still match, and that's where things start to collide. Can you please tell me how to retrieve the correct private key in 64-byte format?
Issue solved by using github.com/cretz/bine/torutil/ed25519.
See stackoverflow.com/questions/44810708/ed25519-public-result-is-different for more information.