Ok, this is really ugly, so hopefully JSON-RPC dies soon...
noncerange is provided to the miner in the usual big endian format: 100000001fffffff for all nonces from 0x10000000 to 0x1fffffff; this part is sane at least
However, since SHA256 processes in big-endian integers, while the rest of our block data is given in little-endian, this part gets hairy: the nonce will always come out in the opposite
endian as the rest of the data. Since solutions are given as 32-bit big endian chunks, this means that in the solution
, your nonce will be written as little endian. So for our example, dddddd1d is acceptable, and 1ddddddd is not.
On the bright side, this means you can do a simple iterative for loop from <nonce-start> to <nonce-end> and just plug the value into the nonce index in the SHA256 integer data regardless of what endian your platform is