fixed
This commit is contained in:
parent
3634311467
commit
1e8fc76f22
@ -109,9 +109,9 @@ inline void invertKey(const unsigned char* __restrict key, Key& inverted) noexce
|
||||
state ^= state << 4;
|
||||
return static_cast<long long>(state * 2685821657736338717);
|
||||
}
|
||||
inline void rmbytes(unsigned char* __restrict buf, unsigned char size, unsigned long& state) noexcept {
|
||||
for (unsigned char x = 0; x < 32; x++) {
|
||||
_mm256_store_si256((__m256i*) & buf[x * 32], _mm256_set_epi64x(xorshift64(state), xorshift64(state), xorshift64(state), xorshift64(state)));
|
||||
inline void rmbytes(unsigned char* __restrict buf, unsigned long& state) noexcept {
|
||||
for (unsigned char x = 0; x < 1; x++) {
|
||||
_mm256_storeu_si256((__m256i*) & buf[x * 32], _mm256_set_epi64x(xorshift64(state), xorshift64(state), xorshift64(state), xorshift64(state)));
|
||||
}
|
||||
}
|
||||
inline void sign_keypair(unsigned char* __restrict pk, unsigned char* __restrict sk, const unsigned char* __restrict seed) noexcept {
|
||||
@ -119,21 +119,25 @@ inline void sign_keypair(unsigned char* __restrict pk, unsigned char* __restrict
|
||||
crypto_hash_sha512(h, seed, 32);
|
||||
h[31] = (h[31] & 0xF8) | (0x40 | (h[31] & 0x7F));
|
||||
crypto_scalarmult_ed25519_base(pk, h);
|
||||
_mm256_store_si256(reinterpret_cast<__m256i*>(sk), _mm256_load_si256(reinterpret_cast<const __m256i*>(seed)));
|
||||
_mm256_store_si256(reinterpret_cast<__m256i*>(sk + 32), _mm256_load_si256(reinterpret_cast<const __m256i*>(pk)));
|
||||
_mm256_storeu_si256(reinterpret_cast<__m256i*>(sk), _mm256_loadu_si256(reinterpret_cast<const __m256i*>(seed)));
|
||||
_mm256_storeu_si256(reinterpret_cast<__m256i*>(sk + 32), _mm256_loadu_si256(reinterpret_cast<const __m256i*>(pk)));
|
||||
}
|
||||
|
||||
void miner_thread() noexcept {
|
||||
alignas(32) Key inv;
|
||||
alignas(32) Key seed;
|
||||
KeysBox keys;
|
||||
Address rawAddr;
|
||||
unsigned char ones = 0;
|
||||
std::random_device rd;
|
||||
unsigned long state = static_cast<unsigned long>(rd());
|
||||
printf("Using seed: %lu\n", state);
|
||||
while (true) {
|
||||
rmbytes(seed, sizeof(seed), state);
|
||||
rmbytes(seed, state);
|
||||
//sign_keypair(keys.PublicKey, keys.PrivateKey, seed);
|
||||
crypto_sign_ed25519_seed_keypair(keys.PublicKey, keys.PrivateKey, seed);
|
||||
if (unsigned char ones = getZeros(keys.PublicKey); ones > conf.high.load()) {
|
||||
ones = getZeros(keys.PublicKey);
|
||||
if (ones > conf.high.load()) {
|
||||
conf.high.store(ones);
|
||||
invertKey(keys.PublicKey, inv);
|
||||
getRawAddress(ones, inv, rawAddr);
|
||||
@ -141,6 +145,7 @@ void miner_thread() noexcept {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void startThreads() noexcept {
|
||||
std::vector<std::thread> threads;
|
||||
threads.reserve(conf.proc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user