3

I'm looking to port an old game I wrote for the Palm Pilot that relied on the SysRandom function with a predefined game seed. A player could enter a "seed" and the sequence of tiles would be deterministic. So if I can recreate the SysRandom function in another language (JavaScript is my jam, but I can probably port C and most other languages if pushed) then I can retain all the old player's high scores from the original game.

I'm not even sure where to start searching though!

0

1 Answer 1

12

The Palm SysRandom RNG was reverse-engineered by Ian Goldberg and documented e.g. in this Password Generator exploit:

/* The PalmOS SysRandom() RNG. */

static unsigned int multiplier = 22695477;
static unsigned int _seed = 0;

short palm_rand (unsigned int new_seed)
{
  if (new_seed)
    _seed = new_seed;
  
  _seed = (_seed * multiplier) + 1;
  return (short)  ((_seed >> 16)  & 0x7fff);
}

(See also the corresponding SecurityTracker entry which provides Thomas Roessler’s full message. This RNG is also briefly described in Peter Gutmann’s Cryptographic Security Architecture: Design and Verification.)

6
  • Hmm, the same multiplier as Borland C's LCG
    – scruss
    Sep 7, 2020 at 15:11
  • Interesting. So the first random number (assuming it is not reseeded) is always zero.
    – abligh
    Sep 8, 2020 at 6:02
  • If you happen to find the sources of POSE (the Palm OS Emulator) you might see some "real" source code. I remember that I once found the source of the CRC funtions. Sep 8, 2020 at 10:08
  • 1
    @thebusybee I had checked, without much hope because I expected SysRandom to be implemented in the ROMs, and it is (so no source code in POSE). Sep 8, 2020 at 11:01
  • 2
    (The POSE source code if still available from SourceForge.) Sep 8, 2020 at 11:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .