State of PRNG code in GMP

Niels Möller nisse at lysator.liu.se
Tue Jun 9 13:17:05 UTC 2020


tg at gmplib.org (Torbjörn Granlund) writes:

> nisse at lysator.liu.se (Niels Möller) writes:
>
>   Does generic code really need to copy the algorithm specific data?
>
> It seems nicer to have generic code do as much as possible.  And it
> saves having pointers in the struct for copy and cleanup functions.
>
> Do you see any disadvantage?

It's a constraint on what the algorithm internal struct can look like,
e.g., it can't have internal pointers (but it could have offsets). So
not necessarily a show-stopper, but we should be aware when designing
the interfaces.

I do see some usecases for copying, to be able to save generator state
and restart in the same state later. It may even be useful to be able do
save generator state to disk, if you want to write periodic
"checkpoints" for an algorithm that needs to run for a long time.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.


More information about the gmp-devel mailing list