Re: [kvm-unit-tests PATCH v3 1/7] lib: Add pseudo random functions

Nico Boehr
2024-10-10T08:26:11Z

Quoting Nina Schoetterl-Glausch (2024-06-20 16:16:54)
> Add functions for generating pseudo random 32 and 64 bit values.
> The implementation uses SHA-256 and so the randomness should have good
> quality.
> Implement the necessary subset of SHA-256.
> The PRNG algorithm is equivalent to the following python snippet:
>
> def prng32(seed):
> from hashlib import sha256
> state = seed.to_bytes(8, byteorder="big")
> while True:
> state = sha256(state).digest()
> for i in range(8):
> yield int.from_bytes(state[i*4:(i+1)*4], byteorder="big")

Thomas, Andrew,
do you want to take this patch or is it OK it if comes with the whole
series via s390x tree?