Does hash_df use binary or an ASCII hexadecimal representation for numbers to be passed to the hash function?
In step 4.1 of the algorithm:


Counter is expected to be a 1 byte binary value
no_of_bits_to_return is a 4 byte bigendian binary value
input_string is a variable length binary value
$||$ is concatination (just like you guessed)


So, Hash(&amp;bytearray) would be appropriate.

The trickiest part is the 'no_of_bits_to_return' -- that's bigendian (and so a value of 24 would be represented by the four bytes 0x00 0x00 0x00 0x18), which is the opposite of how the most common processors internally represent a 4 byte value.

Now, if you were to convert to (say) ASCII hex first, well, it probably won't affect the security of the algorithm; however, it won't be the HASH_DRBG algorithm, but something else.