Pseudo-Random Number Generation Using Hash Functions and MACs

 Outline :

1. PRNG Based on Hash Function

2. PRNG Based on MAC Function

1. PRNG Based on Hash Function 

Note 1 : It is recommended for reader that if they want to know about the better clarity regarding this blog then please study well about PRNG or you can copy and paste the given link on your web browser. ( shorturl.at/cpEG8 )

Figure 1 shows the basic strategy for a Hash based PRNG.


Fig. 1 : Basic Structure of Hash Based PRNGs 

This algorithm uses the cryptographic hash Function 'H' with an hash value output of outlen bits. The basic operation of the algorithm is : 

Symbol Specification :

V = seed

Seedlen = bit length of V>= k + 64, where k is a desired security level expressed in bits.

n = desired number of output bits.


m = ceil(n/outlen)

data = v

W = the null string

For i = 1 to m

    Wi = H(data)

     W = W || Wi

 data = (data + 1) mod 2seedlen

Return leftmost n bits of w

2. PRNG Based on MAC Function :

Although there is no known or suspected weakness in the use of cryptographic hash function for a PRNG, but a higher degree of confidence can be achieved by using a MAC. 

TABLE I : Three PRNG Based on HMAC

m = ceil(n/outlen)

Wo = V

W = the null string

For i = 1 to m

     wi = MAC(K,wi-1)

     W = W || wi

Return leftmost n bits of W

m = ceil(n/outlen)

W = the null string

For i = 1 to m

    wi = MAC(K, (V||i))

     W = W || wi

Return leftmost n bits of W

m = ceil(n/outlen)

A(0) = V

W = the null string

For i = 1 to m

A(i) = MAC(K,A(i-1))

wi = MAC(K, (A(i) || V)

W = W || wi

Return leftmost n bits of W


*****************************************************************************************************************************

Comments

Popular posts from this blog

Homomorphic Encryption: A Basic Idea

Fast Base Conversion and Its Application

Brakerski-Fan-Vercauteren (BFV) Homomorphic Encryption