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
)?
1 Answer
Since I saw your issue on GitHub closed by yourself, I think I should mention what helped you solve your issue in the answer.
Issue solved by using https://github.com/cretz/bine/torutil/ed25519.
See https://stackoverflow.com/questions/44810708/ed25519-public-result-is-different for more information.
https://stackoverflow.com/a/44874097 :
This is due to different ed25519 private key formats. An ed25519 key starts out as a 32 byte seed. This seed is hashed with SHA512 to produce 64 bytes (a couple of bits are flipped too). The first 32 bytes of these are used to generate the public key (which is also 32 bytes), and the last 32 bytes are used in the generation of the signature.
The Golang private key format is the 32 byte seed concatenated with the 32 byte public key. The private keys in the Bittorrent document you are using are the 64 byte result of the hash (or possibly just 64 random bytes that are used the same way as the hash result).
Since it’s not possible to reverse the hash, you can’t convert the Bittorrent keys to a format that the Golang API will accept.