Problem with gmp_randinit_set

Marco Bodrato bodrato at mail.dm.unipi.it
Mon Feb 20 09:18:55 UTC 2017


Ciao,

Il Lun, 20 Febbraio 2017 7:09 am, Niels Möller ha scritto:
> (And then I realized that one has to produce a canonical representation
> also for the initial reduction, since that uses a different modulo, p-4).

That must be canonical, to mimic the current code.

>> If we "do not want to generate different sequences than earlier GMP",
>> we will have to mimic current behaviour, even in the corner cases...

> I think that should be doable, if we want to. Without thinking too
> deeply about it, it looks like your variant with shift should be
> equivalent to the current mpz code, maybe mine too (it essentially
> combines the shift with the addmul_1 call).

I'm not sure they are, neither one of them. Both your code and mine may (I
fear) give a number greater than 2^19937 as a result. Even if we change
them to take care of the possible carry in those last additions, we may
have problems with the (few!) numbers in the range 2^19937-20000..2^19937.

>> Is it worth doing?
>
> I think it's desirable to eliminate the dependency on mpz. How important

I agree.

> it is not change the seed --> sequence mapping, I don't know.

I personally think we can deal with an incompatibility in this. And I like
the idea of using a crypto-primitive.

Regards,
m

-- 
http://bodrato.it/



More information about the gmp-devel mailing list