Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > General
User Name
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!


  Search this Thread
Old 09-14-2011, 04:45 PM   #1
LQ Newbie
Registered: Aug 2011
Posts: 12

Rep: Reputation: Disabled
How does Cygwin's /dev/random and urandom work?

Does anybody knows how does Cygwin's /dev/urandom works? Like, what algorithm it uses, where does the entropy comes from, stuff like that?

I'm considering if this device's randomness is worth using to erase an entire drive from Windows, or whether it's faster than Debian's /dev/urandom which tops at 12 MB/s on my desktop computer (using two concurrent dd processes), which is far too slow when you have to generate like 500 GB of pseudorandom data.
Old 10-09-2011, 09:18 AM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
The cygwin /dev/random makes use of the underlying CryptGenRandom from the Windows API. This draws from a number of entropy sources (though the code is not open source), such as process id, thread id, system clock, system time, a hash of the user environment block, and so on.

The cygwin /dev/urandom falls back to a pseudo random generator based on the linear congruence one described in Knuth (with a multiplier of 6364136223846793005 and shift of 21). Although it is a high quality random generator, it is not cryptographically strong, so if you really need more security than just writing zeros to the disk sectors (!), then /dev/urandom is perhaps not the best way to go.

If you are generating a significant amount of random data from /dev/urandom, don't forget to use block reads (so that the call overhead is minimized), or just implement the random generator yourself (it is only a few lines of code).

Last edited by neonsignal; 10-09-2011 at 09:22 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dd if=/dev/urandom of=/dev/hda2 bs=1M doesn't work Melsync Linux - General 16 05-19-2014 06:36 PM
Startup Hang after "Using /etc/random-seed to initialize /dev/urandom" DotMatrix Slackware 5 02-26-2010 12:34 AM
[SOLVED] uuencode for random password generation with /dev/urandom JZL240I-U SUSE / openSUSE 27 09-06-2007 01:00 AM
/dev/urandom not that random NoobieDoobieDo Linux - Security 10 02-26-2007 06:18 AM
/dev/random and /dev/urandom pool(s)? kpeirce Linux - Software 2 01-31-2006 06:54 AM > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 12:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration