News for hackers. Stuff that matters.
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by overshard on Saturday August 06, 2022 @11:06AM (#32368754)
And this is when comments in code are important! Any random numbers without a source are immediate suspect to me, especially in something that needs to be secure. It will save your coworkers and peers time trying to figure out why it's there.
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by swatcoder on Saturday August 06, 2022 @11:35AM (#32369001)
That’s true, but this thing is not code any more.

It’s an incantation that’s propagated for 50+ years because it’s minimal and effective. Over time, it’s been fully distilled to those properties.

Since comments aren’t essential to being minimal and effective, they don’t survive the distillation.

Think of it like a clever gist that got pasted and shared a hundred times. Even if the original source had explained every step in great detail, with inline comments and deep explanatory discourses and citations to prior art and etc, they’d eventually get trimmed away as fat as people repeatedly prune it down to some “important” bits pasted into their own copies and then later share those trimmed copies, ad infinitum.

This is that, but 50 years out.

Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by AstralStorm on Saturday August 06, 2022 @11:50AM (#32369132)
Since it's an LCG, it does not matter how it was derived as long as the randomness properties are known. Such as cycle length, identical initial state set and dispersion properties. Perhaps also performance.

These should be documented.

It's a rather weak PRNG of short cycle, so the suspicion is that it's made for particular dispersion properties, such as for a hash table of particular data and size or other bucketing algorithm.

Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by ChrisLomont on Saturday August 06, 2022 @03:38PM (#32370920)
>These should be documented.

They're trivial to look up, and any modern source would likely outlive the game of telephone of trying to keep such a comment intact correctly.

Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by bee_rider on Saturday August 06, 2022 @11:13AM (#32368809)
It is interesting -- 5/9 of the books listed there are clearly numerics textbooks, so it isn't surprising they talked about a non-cryptographic PRNG. Curious about the other 4. But maybe this shows up as a "here's why you should be careful what type of RNG you are using" type example.
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by krater23 on Saturday August 06, 2022 @05:04PM (#32371575)
When you find this algorithm with or without any comments from where the numbers come from in a point that should be secure, you should be more than suspect. In any way, this is not a secure PRNG.
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by pclmulqdq on Saturday August 06, 2022 @11:43AM (#32369066)
For PRNGs like this, constants are often chosen by guess and check. This algorithm (an LCG) has a bit more theory, so these might not have been chosen that way, but the author of the code probably didn't have any insight either.
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by nailer on Sunday August 07, 2022 @02:33AM (#32374376)
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by Waterluvian on Saturday August 06, 2022 @11:13AM (#32368802)
“No magic numbers.”
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by eru on Saturday August 06, 2022 @11:19AM (#32368859)
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by Waterluvian on Saturday August 06, 2022 @11:20AM (#32368875)
That’s clever!
Re:Original source of `(seed * 9301 and 49297) % 233280` ran... by JKCalhoun on Saturday August 06, 2022 @01:06PM (#32369764)
Security through obscurity?

Maybe not.