How to realize a hash function H:{0,1}* × G × {0,1}* -> Zq ？ I read papers about cloud storage data integrity audit, which needs PBC library and GMP library.
The author define encryption hash function  $H:\{0,1\}^* \times G \times \{0,1\}^* \to \Bbb Z_q$, used as $H(ID,R,RN) \bmod q$, $G$ is a cyclic multiplicative group with order $q$ ,$q$ is a large prime, $R, ID,RN$ are elements of $G$.
I don't know how to compute $H(ID,R,RN) \bmod q$ ,they may multiply or do exponent arithmetic ?or use hash function like SHA1 ? How can I construct this function?
If elements $R$ of $G$ can uniquely be expressed as a bitstring $\overline R$ (e.g. by taking the two components in a finite field of the affine coordinates of $R$, each uniquely representable as a fixed-size bitstring, and these are concatenated to form $\overline R$), then it is easy to construct a generic hash $H:\{0,1\}^* \times G \times \{0,1\}^* \to \mathbb Z_q$ from a standard $b$-bit hash $F:\{0,1\}^* \to \{0,1\}^b$, say SHA-512 with $b=512$, as follows:

$h\gets F\big(F(\text{ID})\mathbin\|F(\overline R)\mathbin\|F(\text{RN})\big)$, which is a hash of $(\text{ID},R,\text{RN})$ in the set $\{0,1\}^b$
if $\log_2q&gt;b/2\,$, expand $h$ as follows:

$g\gets h$
for $i$ from $1$ to $\big\lceil(\log_2q-b/2)/b\big\rceil\,$

$h\gets h\mathbin\|F(g\mathbin\|\overline i)\,$, where $\overline i$ is a bitstring uniquely representing the integer $i\,$ (e.g. encoding $i$ in big-endian base 256 as a minimal number of bytes, then converted to binary)




$r\gets \underline h\bmod q\,$, where $\underline h$ is the integer coded by the bitstring $h$ per big-endian binary

The result $r$ is the desired hash of $(\text{ID},R,\text{RN})$ in the set $\mathbb Z_q$.
This hash has nearly the same security as $F$ or an ideal hash in $\mathbb Z_q$, whichever is lower. Argument (or lack of a reference), under a model of the hash $F$ as a random oracle (and any security reduction is is with respect to that):

The step &quot;$h\gets F\big(F(\text{ID})\mathbin\|F(\overline R)\mathbin\|F(\text{RN})\big)$&quot; is a generic composition of hashes, in order to hash multiple inputs of variable size (while maintaining collision resistance contrary to mere concatenation), and allowing a security reduction.
The step &quot;if $\log_2q&gt;b/2\,$, expand $h$&quot; does that essentially as in MGF1, again allowing a security reduction.
The step &quot;$r\gets \underline h\bmod q\,$&quot; insures the output is in the desired range. It create a bias towards low values, but since at least $b/2$ bits are discarded this bias is low, and it's possible to upper-bound the advantage a distinguisher can obtain.