Community discussion forum

How to access Random Number Generator in windows ????

  • 1 year ago

    Hey guys, In trying to port some code win32, but having some serious trouble.

    the AMD Geode-LX processor has a hardware Random number generator, i need to be able to read from it in windows.

    I have been looking all over MSDN for hours, aswell as googling , but i have found nothing.

    the rand() function is only software low quality pseudo random, even when hardware support is installed. 

     The Code in linux is as follows....

    FILE* rng;

    BOOL hw_rng_init(void)

    {

         return (rng = fopen("/dev/hwrandom"))?TRUE:FALSE;

    }
     

    char hw_rng_get8()

    {

         char number;

         fread(&number,1,1, rng)
     

        return number;
     

     

    short hw_rng_get16()

    {

         short number;

         fread(&number,1,2, rng)
     

        return number;

    }

     

    int hw_rng_get32()

    {

         int number;

         fread(&number,1,4, rng)
     

        return number;

    }

     

     

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Want to stay in touch with what's going on? Follow us on twitter!