|
May 31, 2011, 05:06:21 PM |
|
The response of getwork request is: data:00000001dfa9247a8ded0663ebb3b2ef9787044074ff42508190ef3a00001cc5000000000574128 7c1c19b9ecac6e56c6d20078da9e1ce40575900ad463ccc73ee71598c4de32f1e1a269421000000 0000000080000000000000000000000000000000000000000000000000000000000000000000000 0000000000080020000 hash1:0000000000000000000000000000000000000000000000000000000000000000000000800000000 0000000000000000000000000000000000000000000010000 target:0000000000000000000000000000000000000000000000219426000000000000 midstate:39f960097671413910bd7637b2f28c5c2231316e2b12d16f2f9be77a0f6c1df1
I can't find an answer by algorithm as below: (the algorithm is copied from gaeminer)
public boolean scan(Work work, int start, int count) { SHA256 sha256 = new SHA256();
int[] _data = decode(new int[16], work.getData().substring(128)); int[] _midstate = decode(decode(new int[16], work.getHash1()), work.getMidstate());
int[] __state, __data, __hash1, __hash; for (int nonce = start; nonce < start + count; nonce++) { _data[3] = nonce; // NONCE is _data[3] hashed++; if ((nonce & 0xFFFFF) == 13) { LOG.info("nonce = " + nonce); }
__state = new int[_midstate.length]; System.arraycopy(_midstate, 0, __state, 0, _midstate.length); __data = _data;
sha256.processBlock(__state, __data); __hash1 = __state;
__state = SHA256.initState(); sha256.processBlock(__state, __hash1); __hash = __state;
if (__hash[7] == 0) { work.setData(work.getData().substring(0, 128) + encode(__data)); work.setNonce(nonce); return true; } }
return false; }
|