> Ну а я поставил ниже оценку этой статье, по той простой > причине, что в ней не поднята проблема генераторов > псевдослучайных чисел сбора энтропии при генерации паролей. > В частности, утилита apg не использует сбор энтропии под > Windows, в результате генерируемый пароль является менее > стойким, чем словарный. Квиты :)
Скачал таки исходиники. Только что открыл msys-овый shell и сделал
cat /dev/random
Высыпалось нечто случайное и остановилось. Насколько я понимаю, энтропия закончилась.
----------------
Проверил
http://www.google.com/codesearch?hl=ru&q=+package:mingw+random+show:WMQZoclNlWs:k2rNSjKY1ng:_U9YIVvRIkY&sa=N&cd=92&ct=rc&cs_p=ftp://gd.tuwien.ac.at/gnu/mingw/msys-1.0.10-rc-src-1.tar.bz2&cs_f=msys/1.0/10/rt/src/winsup/cygwin/path.cc#a0
Функция get_device_number
else if (deveq ("random")|deveq ("urandom"))
{
devn = FH_RANDOM;
unit = 8 + (deveqn ("u", 1) ? 1 : 0); /* Keep unit Linux conformant */
} ---
http://www.google.com/codesearch?hl=ru&q=+package:mingw+fh_random+show:arpijB_qN78:M77iags86Eg:rTYQUikCVhs&sa=N&cd=2&ct=rc&cs_p=ftp://gd.tuwien.ac.at/gnu/mingw/msys-1.0.10-src.tar.bz2&cs_f=msys/1.0/10/rt/src/winsup/cygwin/dtable.cc#a0
Функция dtable::build_fhandler
case FH_RANDOM:
fh = new (buf) fhandler_dev_random (name, unit);
break; ---
http://www.google.com/codesearch?hl=ru&q=+package:mingw+fhandler_dev_random+show:r9Uyjgms-vw:nScP7IUJgSE:F2_cH4_hzrM&sa=N&cd=1&ct=rc&cs_p=ftp://gd.tuwien.ac.at/gnu/mingw/msys-1.0.8-src.tar.bz2&cs_f=msys/1.0/8/winsup/cygwin/fhandler_random.cc#a0
Функция fhandler_dev_random::read
if (crypt_gen_random (ptr, len))
return len; ---
Там же, функция fhandler_dev_random::crypt_gen_random
if (!CryptGenRandom (crypt_prov, len, (BYTE *)ptr))
{
debug_printf ("%E = CryptGenRandom()");
return FALSE;
} ---
Собственно, http://msdn2.microsoft.com/en-gb/library/aa379942.aspx
"The data produced by this function is cryptographically random. It is far more random than the data generated by the typical random number generator such as the one shipped with your C compiler."
"With Microsoft CSPs, CryptGenRandom uses the same random number generator used by other security components. This allows numerous processes to contribute to a system-wide seed. CryptoAPI stores an intermediate random seed with every user. To form the seed for the random number generator, a calling application supplies bits it might have—for instance, mouse or keyboard timing input—that are then added to both the stored seed and various system data and user data such as the process ID and thread ID, the system clock, the system time, the system counter, memory status, free disk clusters, the hashed user environment block. This result is SHA-1 hashed, and the output is used to seed an RC4 stream, which is then used as the random stream and used to update the stored seed. If an application has access to a good random source, it can fill the pbBuffer buffer with some random data before calling CryptGenRandom. The CSP then uses this data to further randomize its internal seed. It is acceptable to omit the step of initializing the pbBuffer buffer before calling CryptGenRandom."
Зря минусовал, короче. Под виндой получаются не менее стойкие пароли, чем под *никсами.
|