Looking for a secure PRNG that I can implement in hardware I'm trying to implement a (sort of) simple PRNG in hardware for fun. My idea would be to allow a user to enter a key using a keypad (or some dip switch settings that can be set and hidden) and to obtain a seed using photo, gyro and audio sensors feedback.

I understand I'll probably have to implement some form of modulo arithmetic in hardware. However, I thought up of a hardware-simple algorithm that would only need to use XOR gates. What are your opinions on it?

key = k bits taken from keypad entry
seed = k bits taken from environment sensors
while (true):
    seed &lt;&lt; seed[3]             // rotate the seed if seed[3] is 1
    newSeed &lt;- key XOR seed     // the new seed is XORed with the key
    output &lt;- lsb(newSeed)      // output the lsb of the seed
    seed &lt;- newSeed


It outputs the lsb of the newly calculated seed. I have no experience in algorithm design so I'm sure this is riddled with attacks. If the above is not sufficient for a PRNG, which should I use? Is there one which is known to be simpler for low-bit hardware?
First, you should not write your own CSPRNG - there are plenty of well vetted ones from which you may pick.

Second, your text and your pseudo code do not match (rotate key or rotate the seed).

Third, as I understand this algorithm it doesn't even give good randomness properties.  For example:

Main&gt; let seed = `0x82398eeaf74239 : [64]
Main&gt; let key =  `0x8732754279249  : [64]
Main&gt; let out = take `{256} (prng key seed)
Main&gt; out
0x5555555555555555555555555555555555555555555555555555555555555555