Exercises: Pseudo-Random Generator

Write a code to generate 30 pseudo-random integers in the range [1...10], starting from certain entropy, taken as input, using HMAC key derivation.

From the entropy generate a seed (256-bit binary sequence) using SHA-256:

seed = SHA256(entropy)

Generate the n-th random number by the formula:

1 + HMAC-SHA256(n, seed) % 10

Print the numbers at the output, separated by space.

Sample input and corresponding output:

Last updated