mirror of
https://github.com/PurpleI2P/i2pd-tools.git
synced 2025-02-02 11:04:00 +01:00
commit
4dc9644865
|
@ -68,16 +68,20 @@ Orignal is sensei of crypto ;)
|
||||||
*/
|
*/
|
||||||
std::cout << "Thread " << id_thread << " binded" << std::endl;
|
std::cout << "Thread " << id_thread << " binded" << std::endl;
|
||||||
|
|
||||||
|
union{
|
||||||
uint8_t b[391];
|
uint8_t b[391];
|
||||||
memcpy (b, buf, 391);
|
uint32_t ll;
|
||||||
|
}local;
|
||||||
|
|
||||||
|
memcpy (local.b, buf, 391);
|
||||||
|
|
||||||
int len = strlen (prefix);
|
int len = strlen (prefix);
|
||||||
|
|
||||||
SHA256_CTX ctx, ctx1;
|
SHA256_CTX ctx, ctx1;
|
||||||
SHA256_Init(&ctx);
|
SHA256_Init(&ctx);
|
||||||
SHA256_Update(&ctx, b, MutateByte);
|
SHA256_Update(&ctx, local.b, MutateByte);
|
||||||
|
|
||||||
uint32_t * nonce = (uint32_t *)(b+MutateByte); // in nonce copy of MutateByte of b;
|
uint32_t * nonce = (uint32_t *)(local.b+MutateByte); // in nonce copy of MutateByte of b;
|
||||||
(*nonce)+=id_thread*throughput;
|
(*nonce)+=id_thread*throughput;
|
||||||
|
|
||||||
uint8_t hash[32];
|
uint8_t hash[32];
|
||||||
|
@ -86,7 +90,7 @@ Orignal is sensei of crypto ;)
|
||||||
while(throughput-- and !found){
|
while(throughput-- and !found){
|
||||||
|
|
||||||
memcpy (&ctx1, &ctx, sizeof (SHA256_CTX));
|
memcpy (&ctx1, &ctx, sizeof (SHA256_CTX));
|
||||||
SHA256_Update(&ctx1, b + MutateByte, 71);
|
SHA256_Update(&ctx1, local.b + MutateByte, 71);
|
||||||
SHA256_Final(hash, &ctx1);
|
SHA256_Final(hash, &ctx1);
|
||||||
ByteStreamToBase32 (hash, 32, addr, len);
|
ByteStreamToBase32 (hash, 32, addr, len);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue