<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<font face="Courier New, Courier, monospace">Dear developers, <br>
<br>
</font>
<p><font face="Courier New, Courier, monospace">How can I derive an
identity public key given onion secret key in form of:<br>
</font></p>
<font face="Courier New, Courier, monospace"><code style="margin:
0px; padding: 0px; border: 0px none; font-style: inherit;
font-variant: inherit; font-weight: inherit; font-stretch:
inherit; line-height: inherit; font-size: 13px; vertical-align:
baseline; box-sizing: inherit; background-color: transparent;
white-space: inherit;">ED25519-V3:UJL1wgWVeMz9f7oM+Xrbq0i8tJ2/aeBi3K0cl8VCrlicSts8Gg98agO5DUXHjsfQb+yooLgN0CB0Y0A9U0rMUQ==</code></font>
<p><font face="Courier New, Courier, monospace">?</font></p>
<font face="Courier New, Courier, monospace"><br>
I assume that a secret key is 64 bytes long, and identity public
key is last 32 bytes of decoded private key. So, my algorithm is
as follows:<br>
</font><br>
<font face="Courier New, Courier, monospace"><code style="margin:
0px; padding: 0px; border: 0px none; font-style: inherit;
font-variant: inherit; font-weight: inherit; font-stretch:
inherit; line-height: inherit; font-size: 13px; vertical-align:
baseline; box-sizing: inherit; background-color: transparent;
white-space: inherit;">base64Decode(privatekey) //without
ED25519-V3: part <br>
</code></font><font face="Courier New, Courier, monospace"><code
style="margin: 0px; padding: 0px; border: 0px none; font-style:
inherit; font-variant: inherit; font-weight: inherit;
font-stretch: inherit; line-height: inherit; font-size: 13px;
vertical-align: baseline; box-sizing: inherit; background-color:
transparent; white-space: inherit;">slice resulting buffer in
half <br>
</code></font><font face="Courier New, Courier, monospace"><code
style="margin: 0px; padding: 0px; border: 0px none; font-style:
inherit; font-variant: inherit; font-weight: inherit;
font-stretch: inherit; line-height: inherit; font-size: 13px;
vertical-align: baseline; box-sizing: inherit; background-color:
transparent; white-space: inherit;">base32Encode(second half of
the buffer)</code></font><br>
<font face="Courier New, Courier, monospace">
<br>
As a result I expect to see first 52 characters of corresponding
onion address, but I see totally unrelated random string instead.<br>
<br>
<br>
I've already tested the part that converts a public key into onion
address as per tor/src/test/hs_build_addres.py, that part is
working.<br>
The problem is that I derive wrong identity public key from the
secret key.<br>
<br>
<code style="margin: 0px; padding: 0px; border: 0px none;
font-style: inherit; font-variant: inherit; font-weight:
inherit; font-stretch: inherit; line-height: inherit; font-size:
13px; vertical-align: baseline; box-sizing: inherit;
background-color: transparent; white-space: inherit;"></code>Thank
you!<br>
<code style="margin: 0px; padding: 0px; border: 0px none;
font-style: inherit; font-variant: inherit; font-weight:
inherit; font-stretch: inherit; line-height: inherit; font-size:
13px; vertical-align: baseline; box-sizing: inherit;
background-color: transparent; white-space: inherit;"></code></font>
</body>
</html>