ctr++;
ctr = RotL32(ctr, 29) + ctr;
On Monday, October 12, 2015 at 6:59:58 AM UTC-4, Karl-Uwe Frank
wrote:
ctr++; ctr = RotL32(ctr, 29) + ctr;
(I probably won't post anything else on this, but the "counter"
looked interesting.)
So now the "counter" serves to generate a keystream for the a,d,t
generator.. You might want to look for degenerate cycles of that
keystream.
I took 1000 random starting values for ctr, and looked at what cycle
they ended up in. Assuming I implemented the counter's update
function correctly, 990 of them ended up in one of two different
cycles with period 111924. It typically took on the order of 18K
steps before it entered the cycle. These cycles were reached with
nearly equal probability.
Nine other starting values arrived at a cycle with period 6760.
The remaining starting value arrived at a cycle with period 4522.
Offhand, I think a random mapping over M is expected to reach cycles
with length ≈sqrt(M), and 112K is about right. The fact that there
are two cycles with the same period suggests the cycles may be
correlated. And that suggests the mapping might induce some simple relationship that partitions the domain.
The shorter cycles might be worrisome. There are likely to be even
shorter ones but, in a probabilistic sense, they appear to be harder
to reach.
Bob H
The only solution I can currently think of is having one additional
variable as bit mixer plus the counter
//--------------------------------------
static uint32_t a, b, c, d, t, ctr, mix;
// The Seeding Function
void seed_bcd32_ctr(uint32_t seed[]) {
a = seed[0];
b = seed[1];
c = seed[2];
d = seed[3];
t = a + b + c + d;
ctr = seed[4];
}
// The PRNG Function
uint32_t bcd32_ctr() {
// update the counter first
ctr++;
// bit injector
mix ^= RotL32(mix, 29) + ctr;
a = a + (d >> 5) + (mix << 23);
b = a + (b ^ c);
c = a + (b << 13);
d = a + (d ^ t) + (mix >> 13);
t = a + t;
return (b ^ c ^ d);
}
//--------------------------------------
On Monday, October 12, 2015 at 6:59:58 AM UTC-4, Karl-Uwe Frank wrote:order of 18K steps before it entered the cycle. These cycles were reached with nearly equal probability.
ctr++;
ctr = RotL32(ctr, 29) + ctr;
(I probably won't post anything else on this, but the "counter" looked interesting.)
So now the "counter" serves to generate a keystream for the a,d,t generator.. You might want to look for degenerate cycles of that keystream.
I took 1000 random starting values for ctr, and looked at what cycle they ended up in. Assuming I implemented the counter's update function correctly, 990 of them ended up in one of two different cycles with period 111924. It typically took on the
Nine other starting values arrived at a cycle with period 6760.induce some simple relationship that partitions the domain.
The remaining starting value arrived at a cycle with period 4522.
Offhand, I think a random mapping over M is expected to reach cycles with length ≈sqrt(M), and 112K is about right. The fact that there are two cycles with the same period suggests the cycles may be correlated. And that suggests the mapping might
The shorter cycles might be worrisome. There are likely to be even shorter ones but, in a probabilistic sense, they appear to be harder to reach.
Bob H
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 112 |
Nodes: | 8 (1 / 7) |
Uptime: | 09:24:29 |
Calls: | 2,468 |
Files: | 8,620 |
Messages: | 1,889,475 |