lol yea wow sorry about that. divide
shift right if you're using a 2^n diff, divide by difficulty.
when using getwork, there should be a "target" field in the JSON response (should be data, hash1, and target).
target is the little-endian result of the divided dif 1 hash
targetBytes = bintToBytes(difMask / difficulty, 32).reverse //32 bytes
not sure the exact method for going backwards, but I think you can just do dif1hash / target