From: porkchop@invalid.foo   
      
   On Wed, 24 Dec 2025 17:44:52 +0200, Michael S wrote:   
      
   > On Wed, 24 Dec 2025 15:28:24 -0000 (UTC)   
   > Michael Sanders wrote:   
   >   
   >> On Wed, 24 Dec 2025 10:51:14 +0200, Michael S wrote:   
   >>   
   >> > On Tue, 23 Dec 2025 07:25:42 -0000 (UTC)   
   >> > Michael Sanders wrote:   
   >> >   
   >> >> On Tue, 23 Dec 2025 00:39:49 -0000 (UTC), John McCue wrote:   
   >> >>   
   >> >> > I like to just read /dev/urandom when I need a random   
   >> >> > number. Seem easier and more portable across Linux &   
   >> >> > the *BSDs.   
   >> >> >   
   >> >> > int s;   
   >> >> > read(fd, &s, sizeof(int));   
   >> >>   
   >> >> Thanks John. Wish there was such a 'device' under Windows...   
   >> >>   
   >> >   
   >> > There is.   
   >> > Windows XP/Vista/7:   
   >> > https://learn.microsoft.com/en-us/windows/win32/api/wincryp   
   /nf-wincrypt-cryptgenrandom   
   >> > Win8 and later:   
   >> > https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/   
   f-bcrypt-bcryptgenrandom   
   >> >   
   >>   
   >> Was referring to the concept of a device in the same idiom of   
   >> BSD/Linux/Apple...   
   >>   
   >> Something that is just as easy to use.   
   >>   
   >   
   > What is not easy in the functions referred above? You do the same   
   > couple of steps as on Unix: open device then read few bytes from it.   
   > Only names are different.   
      
   Depends the toolkit no?   
      
   Unix:   
   $ head -c 8 /dev/urandom | od -An | tr -d ' '   
   4fa2c3d17b9a8f12   
      
   Windows:   
   PS C:\Users\Bob>   
   $bytes = New-Object byte[] 8   
   [System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)   
   [Console]::Write($bytes | ForEach-Object { "{0:x2}" -f $_ })   
      
   --   
   :wq   
   Mike Sanders   
   es   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|