Reduce PoW cost just a bit.

This commit is contained in:
Adam Ierymenko 2020-03-15 20:14:35 -07:00
parent 3408839b33
commit 1c7baa544b
No known key found for this signature in database
GPG key ID: C8877CF2D7A5D7F3
3 changed files with 5 additions and 4 deletions

View file

@ -145,10 +145,11 @@ bool _v1_identity_generate_cond(const void *in,const unsigned int len)
poly1305(b,b,sizeof(b),polykey);
#if __BYTE_ORDER == __BIG_ENDIAN
return ((Utils::swapBytes(b[0]) + Utils::swapBytes(b[1])) >> 56U) == 0;
const uint64_t finalHash = Utils::swapBytes(b[0]) + Utils::swapBytes(b[1]);
#else
return ((b[0] + b[1]) & 0xffU) == 0;
const uint64_t finalHash = b[0] + b[1];
#endif
return (finalHash % 180U) == 0;
}
} // anonymous namespace

View file

@ -53,7 +53,7 @@
#ifndef __CPP11__
// Beyond that defining nullptr, constexpr, and noexcept should allow us to still build on these. So far we've
// avoided deeper C++11 features like lambdas in the core until we're 100% sure all the ancient targets are gone.
#error TODO: to build on pre-c++11 compilers we'll need to make a subset "polyfill" of std::atomic for integers
#error TODO: to build on pre-c++11 compilers we will need to make a subset of std::atomic for integers
#define nullptr (0)
#define constexpr ZT_INLINE
#define noexcept throw()

View file

@ -177,7 +177,7 @@ static const C25519TestVector C25519_TEST_VECTORS[ZT_NUM_C25519_TEST_VECTORS] =
};
#define IDENTITY_V0_KNOWN_GOOD_0 "8e4df28b72:0:ac3d46abe0c21f3cfe7a6c8d6a85cfcffcb82fbd55af6a4d6350657c68200843fa2e16f9418bbd9702cae365f2af5fb4c420908b803a681d4daef6114d78a2d7:bd8dd6e4ce7022d2f812797a80c6ee8ad180dc4ebf301dec8b06d1be08832bddd63a2f1cfa7b2c504474c75bdc8898ba476ef92e8e2d0509f8441985171ff16e"
#define IDENTITY_V1_KNOWN_GOOD_0 "967a154b9a:1:54jko57fyyh4o3ujrecicqkuz4j2nyglojufv4slofa2ul2eyyoq3q4c2hwkeyw3dvgwrpulucfg7dl26bbqmt3y42s4dq3rmu2xqjerakhvajh4it3uaipa4fzqxdclhjz7ua3w2k42xksjwvbmqnyiwndlif3tyzmf3sd6e7kkmabiw4jxatq:zmvxitqjjyxb3bb3vqmr5aihapgtqyuwkra6kinajnmrg3nkhwkqousebnv64xa4zlqe24lokcaazj3bhes4eco6e7ifcdq2grk3yqrojcff5rxylh3cg7hsbtqrhvf7ukyzqzdxunnorqjeiyjicvbba2ljrozx7ekjceru4m34ukg2fhba"
#define IDENTITY_V1_KNOWN_GOOD_0 "8013cb9738:1:avsyitc474r2ylspwjkjvlermiiouaxy3bzzlqtcvafo2gv3abpeyov2zjfyx4vbkxghcoidpjidszt2ibsn4nmmvtpj42clzsxkyt5dajljk2i3x56picaeapayrv5xvd6x6ucgzvei7773xnoj6tyxwcjvqwbhz3joxeb74kdrfq2247hm7ly:54cckqx5fmd54zkmxt6lz2bxn2elws2ju2kv44cqpy7b22n5dlz256iz7j44jc4wyqj4mppyhknbayf2iulu7g4mysgeee5zrtp4zfwqtjnqkn2xpemap5cfm33kldc5kpukg33nqaizcgvekobj6omt3uwro5xboopvgiwdejwmgmpfevja"
// --------------------------------------------------------------------------------------------------------------------