mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-05-16 23:12:49 +00:00
fix version field for -z
This commit is contained in:
parent
822d6fd8a8
commit
0d49a7e2d8
1 changed files with 8 additions and 3 deletions
11
main.c
11
main.c
|
@ -305,7 +305,7 @@ static void *dowork(void *task)
|
||||||
|
|
||||||
memcpy(secret,skprefix,skprefixlen);
|
memcpy(secret,skprefix,skprefixlen);
|
||||||
memcpy(pubonion.raw,pkprefix,pkprefixlen);
|
memcpy(pubonion.raw,pkprefix,pkprefixlen);
|
||||||
pubonion.raw[pkprefixlen + PUBLIC_LEN + 2] = 0x03; // version
|
// write version later as it will be overwritten by hash
|
||||||
memcpy(hashsrc,checksumstr,checksumstrlen);
|
memcpy(hashsrc,checksumstr,checksumstrlen);
|
||||||
hashsrc[checksumstrlen + PUBLIC_LEN] = 0x03; // version
|
hashsrc[checksumstrlen + PUBLIC_LEN] = 0x03; // version
|
||||||
|
|
||||||
|
@ -324,9 +324,12 @@ again:
|
||||||
ed25519_pubkey(pk,sk);
|
ed25519_pubkey(pk,sk);
|
||||||
FILTERFOR(i) {
|
FILTERFOR(i) {
|
||||||
if (unlikely(MATCHFILTER(i,pk))) {
|
if (unlikely(MATCHFILTER(i,pk))) {
|
||||||
|
// calc checksum
|
||||||
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
||||||
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
||||||
pk[PUBLIC_LEN + 2] = 0x03; // version
|
// version byte
|
||||||
|
pk[PUBLIC_LEN + 2] = 0x03;
|
||||||
|
// base32
|
||||||
strcpy(base32_to(&sname[direndpos],pk,PUBONION_LEN), ".onion");
|
strcpy(base32_to(&sname[direndpos],pk,PUBONION_LEN), ".onion");
|
||||||
onionready(sname, secret, pubonion.raw);
|
onionready(sname, secret, pubonion.raw);
|
||||||
goto initseed;
|
goto initseed;
|
||||||
|
@ -375,7 +378,7 @@ static void *dofastwork(void *task)
|
||||||
|
|
||||||
memcpy(secret, skprefix, skprefixlen);
|
memcpy(secret, skprefix, skprefixlen);
|
||||||
memcpy(pubonion.raw, pkprefix, pkprefixlen);
|
memcpy(pubonion.raw, pkprefix, pkprefixlen);
|
||||||
pubonion.raw[pkprefixlen + PUBLIC_LEN + 2] = 0x03; // version
|
// write version later as it will be overwritten by hash
|
||||||
memcpy(hashsrc, checksumstr, checksumstrlen);
|
memcpy(hashsrc, checksumstr, checksumstrlen);
|
||||||
hashsrc[checksumstrlen + PUBLIC_LEN] = 0x03; // version
|
hashsrc[checksumstrlen + PUBLIC_LEN] = 0x03; // version
|
||||||
|
|
||||||
|
@ -413,6 +416,8 @@ initseed:
|
||||||
// calc checksum
|
// calc checksum
|
||||||
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
memcpy(&hashsrc[checksumstrlen],pk,PUBLIC_LEN);
|
||||||
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
FIPS202_SHA3_256(hashsrc,sizeof(hashsrc),&pk[PUBLIC_LEN]);
|
||||||
|
// version byte
|
||||||
|
pk[PUBLIC_LEN + 2] = 0x03;
|
||||||
// full name
|
// full name
|
||||||
strcpy(base32_to(&sname[direndpos],pk,PUBONION_LEN),".onion");
|
strcpy(base32_to(&sname[direndpos],pk,PUBONION_LEN),".onion");
|
||||||
onionready(sname,secret,pubonion.raw);
|
onionready(sname,secret,pubonion.raw);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue