Naor-Reingold Pseudo-Random Function is a function of generating random numbers. Moni Naor and Omer Reingold described efficient constructions for various cryptographic primitives in the private key as well as public-key cryptography.
Input : N = 5 Output: 9.0, 9.0, 3.0, 9.0, 3.0 Input : N = 7 Output: 9.0, 81.0, 9.0, 9.0, 3.0, 3.0, 9.0
- Declare the variables p, l, g, n, x and arrays a and arr
- Take input from the user for generating random numbers
- Generate random numbers and use the defined approach:
Let p and l be prime numbers with l|p−1. Select an element g ε Fp* of multiplicative order l. Then for each n-dimensional vector a = (a0,a1, ..., an). They define the function as: fa(x)=ga0.a1x1a2x2…..anxn ε Fp
- Print the random numbers
Below is the implementation of the Naor-Reingold Pseudo-Random Function:
The Random numbers are: 9.0, 9.0, 3.0, 81.0, 3.0, 81.0, 9.0, 9.0, 3.0, 3.0,
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.