You can look at the references:
https://bitcointalk.org/index.php?topic=120960.0 - has examples of getwork submissions
Here's an old post, follow for more info:
scanhash_c in
https://github.com/jgarzik/cpuminer/blob/master/sha256_generic.c shows midstate and hash1 being used.
Basically, there are 3 chunks that the sha256_transform function in that file is called for per "nonce" value. [Here is the header definition from
https://en.bitcoin.it/wiki/Block_hashing_algorithm:]
Field | Purpose | Updated when... | Size (Bytes) |
Version | Block version number | You upgrade the software and it specifies a new version | 4 |
Previous hash | Hash of the previous block | A new block comes in | 32 |
Merkle root | 256-bit hash based on all of the transactions | A transaction is accepted | 32 |
Timestamp | Current timestamp | Every few seconds | 4 |
"Bits" | Current target in compact format | The difficulty is adjusted | 4 |
Nonce | 32-bit number (starts at 0) | A hash is tried (increments) | 4 |
You are getting a block header, changing the nonce, and returning the hash of it you found which is below the target.
Note that special transforms have to be done before hashing (and then back before submitting results). Endian-ness of data needs to be flipped in 4 byte increments before hashing.
Header contents from your data (hashes are reversed):
000000029af1f43c342ad525e3c4fd9368a76fbe32a2bfc1d5503b6c00000076
00000000e5a720f8ec330f06fab42bb92f24d5d4211002bb202beb163fbeed28
123f8e235166d77c1a022fbe0000000000000080000000000000000000000000
0000000000000000000000000000000000000000000000000000000080020000
Version: 00000002
00000002 9af1f43c342ad525e3c4fd9368a76fbe32a2bfc1d5503b6c00000076
Previous hash: 0000000000000076d5503b6c32a2bfc168a76fbee3c4fd93342ad5259af1f43c
(block
230829)
00000002 9af1f43c342ad525e3c4fd9368a76fbe32a2bfc1d5503b6c00000076
00000000 e5a720f8ec330f06fab42bb92f24d5d4211002bb202beb163fbeed28
Merkle root: 123f8e23fbeed2802beb16311002bb2f24d5d42ab42bb92c330f06fe5a720f8e
00000000 e5a720f8ec330f06fab42bb92f24d5d4211002bb202beb163fbeed28
123f8e23 5166d77c1a022fbe0000000000000080000000000000000000000000
Timestamp: 51 66 d7 7c (1365694332 unix epoch time)
123f8e23 5166d77c 1a022fbe0000000000000080000000000000000000000000
bits (Compact target): 1a 02 2f be
123f8e235166d77c 1a022fbe 0000000000000080000000000000000000000000
nonce: the value your miner will be changing
123f8e235166d77c1a022fbe 00000000 00000080000000000000000000000000
the data1 midstate should be ignored and calculated by your miner, newer mining protocols remove this.