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

  • 13 years 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).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic