1
0
mirror of https://github.com/PurpleI2P/i2pd-tools synced 2025-02-07 04:04:14 +00:00
This commit is contained in:
Warlock-Dalbaeb 2017-08-16 12:47:10 +07:00
parent 7673f8cab9
commit 8d47f128eb

View File

@ -74,7 +74,7 @@ return true;
} }
static size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char * outBuf, size_t outLen) static inline size_t ByteStreamToBase32 (const uint8_t * inBuf, size_t len, char * outBuf, size_t outLen)
{ {
size_t ret = 0, pos = 1; size_t ret = 0, pos = 1;
int bits = 8, tmp = inBuf[0]; int bits = 8, tmp = inBuf[0];
@ -169,28 +169,29 @@ while(throughput-- and !found){
// apply last block // apply last block
TransformBlock (state1, lastW); TransformBlock (state1, lastW);
// get final hash // get final hash
for (int j = 0; j < 8; j++) for (int j = 8; j--;)
hash[j] = htobe32 (state1[j]); hash[j] = htobe32 (state1[j]);
/* /*
*/ */
ByteStreamToBase32 ((uint8_t*)hash, 32, addr, len); ByteStreamToBase32 ((uint8_t*)hash, 32, addr, len);
// std::cout << addr << std::endl;
if( !NotThat(addr,prefix) ){ if( !NotThat(addr,prefix) ){
ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52); ByteStreamToBase32 ((uint8_t*)hash, 32, addr, 52);
std::cout << "Address found " << addr << " in " << id_thread << std::endl; std::cout << "Address found " << addr << " in " << id_thread << std::endl;
found=true; found=true;
FoundNonce=*nonce; FoundNonce=*nonce;
//free(hash); free(hash);
//free(b); free(b);
return true; return true;
} }
(*nonce)++; (*nonce)++;
hashescounter++; hashescounter++;
if (found){ if (found){
//free(hash); free(hash);
//free(b); free(b);
break; break;
} }