Cryptography Reference
In-Depth Information
rstate->RandRMDSHA1Init = 1;
return MissingEntropy;
}
The state function
SwitchRandRMDSHA1_l()
outputs a random byte each time
it is called:
Function:
Deterministic random number generator based
on the hash functions SHA-1 and RIPEMD-160
int SwitchRandRMDSHA1_l (STATERMDSHA1 *rstate);
Syntax:
rstate
(pointer to state memory)
Input:
rstate
(pointer to updated state memory)
Output:
Return:
random value of length one byte
UCHAR
SwitchRandRMDSHA1_l (STATERMDSHA1 *rstate)
{
UCHAR rbyte;
Generation of a random value by application of the function
ψ
(
x, i
) := SHA-1(
x
)
/
2
8
·
(19
−
(
i
mod
16))
mod
2
8
.
ψ
:
S
→
R,
sha1_l (rstate->SRMDSHA1, rstate->XRMDSHA1, 20);
rbyte = rstate->SRMDSHA1[(rstate->RoundRMDSHA1)++ & 15];
State change via application of the function
φ
(
x, i
):=
RIPEMD-160(
x
)
,i
+1
mod
2
32
.
φ
:
S → S,
ripemd160_l (rstate->XRMDSHA1, rstate->XRMDSHA1, 20);
return rbyte;
}
Random numbers
r_l
in the interval
2
l
−
1
≤
r_l
≤
2
l
−
1
are generated via
the function
RandRMDHSA1_l()
, whose function header is given here: