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!

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.)

| improve this answer | |
  • Oh perfect! Thank you 👍 – Remy Sharp Sep 7 at 15:07
  • Hmm, the same multiplier as Borland C's LCG – scruss Sep 7 at 15:11
  • Interesting. So the first random number (assuming it is not reseeded) is always zero. – abligh Sep 8 at 6:02
  • 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). – Stephen Kitt Sep 8 at 11:01
  • 2
    (The POSE source code if still available from SourceForge.) – Stephen Kitt Sep 8 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.