First of all, for the config.c part, I forgot that the target should be specified in LSB byte order (the order of each group of 2 hex digits needs to be reversed)
For example, for the target:
0000000019998000000000000000000000000000000000000000000000000000
You would specify this in config.c as:
0000000000000000000000000000000000000000000000000080991900000000
The target:
00000000051EB333000000000000000000000000000000000000000000000000
Goes to:
00000000000000000000000000000000000000000000000033B31E0500000000
This:
00000000028F6000000000000000000000000000000000000000000000000000
Would be written as:
000000000000000000000000000000000000000000000000000F628000000000
Let me clarify my OP. I know the config.c and how to set the target there. That's the easy one.
Now, open up msg.c and head down to the check_hash function, specifically the return of better_hash. It looks like it is checking a hard coded 40 bits of 0's. Won't I need to change this spot too? What should I change this to based on the 10, 50, 100 scenarios?
Then am I missing any other spots that would also need to be change?
Ah, I missed that initially.
So, for difficulty 10, we'd have the target:
0000000019998000000000000000000000000000000000000000000000000000
We can take the target and split it up into 32 bit sections:
00000000
19998000
00000000
00000000
00000000
00000000
00000000
00000000
The hash has to be less that the target, and the target is using Little endian (LSB first) byte ordering. So, in order for the hash to be less than the target, the first (last because of LSB) 32 bit integer must be zero, and the second integer (2nd to last because of LSB) must be less than or equal to 0x19998000.
So, if you change this line (Line 299):
to:
if (hash32[7] != 0 || hash32[6] > 0x19998000) {
It should check the hash correctly. (The byte swapping on each of the 32 bit fields has been done for us already, but not on the array as a whole, so we start counting at the end which is 7 ; also keep in mind we're zero indexing)
For a difficulty of 50, i'd round off the threes
From:
00000000051EB333333333333333333333333333333333333333333333333333
To:
00000000051EB333000000000000000000000000000000000000000000000000
And simply check hash32[6] against 0x051EB333 instead of 0x19998000.
Similarly, for difficulty 100 i'd just check against 0x028F6000
Note that I don't much like byte swapping, and haven't tested my (one line of) code out, so you might want to get someone else to look over my logic here.
I'll read over the code for any more spots that might need modification in the morning.
(Hardest 1 BTC ever)