mirror of
https://github.com/wiire-a/pixiewps.git
synced 2025-07-27 15:54:29 +02:00
Give possibility to make glibc PRNG work for every seed
Because of the modulo trick the current glibc PRNG version doesn't work for seed == 0x7fffffff or seed == 0xfffffffe. The former is used only if the user specifically uses --start / --end 02/2038. The latter is never used as negative values are not legal for time. In any case a compilation guard (PWPS_UNERRING) has been added for correctness to make the PRNG spit correct values even for those 2 seeds.
This commit is contained in:
parent
0584a78d9b
commit
c44ce9e923
@ -18,6 +18,11 @@ static inline uint32_t *glibc_fast_nonce(uint32_t seed, uint32_t *dest)
|
||||
{
|
||||
uint32_t word0 = 0, word1 = 0, word2 = 0, word3 = 0;
|
||||
|
||||
#ifdef PWPS_UNERRING
|
||||
if (seed == 0x7fffffff) seed = 0x13f835f3;
|
||||
else if (seed == 0xfffffffe) seed = 0x5df735f1;
|
||||
#endif
|
||||
|
||||
for (int j = 0; j < 31; j++) {
|
||||
word0 += seed * glibc_seed_tbl[j + 3];
|
||||
word1 += seed * glibc_seed_tbl[j + 2];
|
||||
@ -42,6 +47,11 @@ static inline uint32_t glibc_fast_seed(uint32_t seed)
|
||||
{
|
||||
uint32_t word0 = 0;
|
||||
|
||||
#ifdef PWPS_UNERRING
|
||||
if (seed == 0x7fffffff) seed = 0x13f835f3;
|
||||
else if (seed == 0xfffffffe) seed = 0x5df735f1;
|
||||
#endif
|
||||
|
||||
for (int j = 3; j < 31 + 3 - 1; j++) {
|
||||
word0 += seed * glibc_seed_tbl[j];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user