Bitcoin Forum
July 10, 2024, 03:26:34 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Other / Beginners & Help / Re: nonce values count & hashrate on: August 26, 2012, 07:32:40 PM
Got it, thanks!
2  Other / Beginners & Help / Re: nonce values count & hashrate on: August 26, 2012, 07:21:13 PM
I don't see anything except nonce is incremented in this code. (CPU miner)

bool scanhash_c(int thr_id, const unsigned char *midstate, unsigned char *data,
           unsigned char *hash, const unsigned char *target,
           uint32_t max_nonce, unsigned long *hashes_done)
{
   uint32_t *hash32 = (uint32_t *) hash;
   uint32_t *nonce = (uint32_t *)(data + 12);
   uint32_t n = 0;
   unsigned long stat_ctr = 0;

   work_restart[thr_id].restart = 0;

   while (1) {
      unsigned char hash1[32];

      n++;
      *nonce = n;

      runhash(hash1, data, midstate);
      runhash(hash, hash1, sha256_init_state);

      stat_ctr++;

      if (unlikely((hash32[7] == 0) && fulltest(hash, target))) {
         *hashes_done = stat_ctr;
         return true;
      }

      if ((n >= max_nonce) || work_restart[thr_id].restart) {
         *hashes_done = stat_ctr;
         return false;
      }
   }
}
3  Other / Beginners & Help / nonce values count & hashrate on: August 26, 2012, 06:51:29 PM
Hi!
maximum value for unsigned 32 bit integer is 4 294 967 295. So in order to try all the values i need to calculate ~4.3 G of hashes. Then if I have 4.3 GH/s rig I would found it in a second. What I missed?
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!