2 void *worker_fast(void *task
)
4 union pubonionunion pubonion
;
5 u8
* const pk
= &pubonion
.raw
[PKPREFIX_SIZE
];
6 u8 secret
[SKPREFIX_SIZE
+ SECRET_LEN
];
7 u8
* const sk
= &secret
[SKPREFIX_SIZE
];
9 u8 hashsrc
[checksumstrlen
+ PUBLIC_LEN
+ 1];
10 u8 wpk
[PUBLIC_LEN
+ 1];
18 struct statstruct
*st
= (struct statstruct
*)task
;
25 memcpy(secret
,skprefix
,SKPREFIX_SIZE
);
27 memset(&pubonion
,0,sizeof(pubonion
));
28 memcpy(pubonion
.raw
,pkprefix
,PKPREFIX_SIZE
);
29 // write version later as it will be overwritten by hash
30 memcpy(hashsrc
,checksumstr
,checksumstrlen
);
31 hashsrc
[checksumstrlen
+ PUBLIC_LEN
] = 0x03; // version
40 randombytes(seed
,sizeof(seed
));
42 ed25519_seckey_expand(sk
,seed
);
44 ge_scalarmult_base(&ge_public
,sk
);
45 ge_p3_tobytes(pk
,&ge_public
);
47 for (counter
= 0;counter
< SIZE_MAX
-8;counter
+= 8) {
50 if (unlikely(endwork
))
55 shiftpk(wpk
,pk
,filter_len(i
));
58 DOFILTER(j
,wpk
,goto secondfind
);
63 shiftpk(wpk
,wpk
,filter_len(j
));
67 // update secret key with counter
68 addsztoscalar32(sk
,counter
);
70 if ((sk
[0] & 248) != sk
[0] || ((sk
[31] & 63) | 64) != sk
[31])
76 memcpy(&hashsrc
[checksumstrlen
],pk
,PUBLIC_LEN
);
77 FIPS202_SHA3_256(hashsrc
,sizeof(hashsrc
),&pk
[PUBLIC_LEN
]);
79 pk
[PUBLIC_LEN
+ 2] = 0x03;
81 strcpy(base32_to(&sname
[direndpos
],pk
,PUBONION_LEN
),".onion");
82 onionready(sname
,secret
,pubonion
.raw
);
83 pk
[PUBLIC_LEN
] = 0; // what is this for?
84 // don't reuse same seed
88 ge_add(&sum
,&ge_public
,&ge_eightpoint
);
89 ge_p1p1_to_p3(&ge_public
,&sum
);
90 ge_p3_tobytes(pk
,&ge_public
);
100 sodium_memzero(secret
,sizeof(secret
));
101 sodium_memzero(seed
,sizeof(seed
));