svn commit: trunk/busybox/loginutils
vda at busybox.net
vda at busybox.net
Tue Dec 12 17:14:56 UTC 2006
Author: vda
Date: 2006-12-12 09:14:56 -0800 (Tue, 12 Dec 2006)
New Revision: 16855
Log:
passwd: added comment
Modified:
trunk/busybox/loginutils/passwd.c
Changeset:
Modified: trunk/busybox/loginutils/passwd.c
===================================================================
--- trunk/busybox/loginutils/passwd.c 2006-12-12 17:01:26 UTC (rev 16854)
+++ trunk/busybox/loginutils/passwd.c 2006-12-12 17:14:56 UTC (rev 16855)
@@ -34,10 +34,15 @@
x += getpid() + time(NULL) + clock();
do {
- /* x = (x*1664525 + 1013904223) mod 2^32 generator is lame
+ /* x = (x*1664525 + 1013904223) % 2^32 generator is lame
* (low-order bit is not "random", etc...),
* but for our purposes it is good enough */
x = x*1664525 + 1013904223;
+ /* BTW, Park and Miller's "minimal standard generator" is
+ * x = x*16807 % ((2^31)-1)
+ * It has no problem with visibly alternating lowest bit
+ * but is also weak in cryptographic sense + needs div,
+ * which needs more code (and slower) on many CPUs */
*p++ = i64c(x >> 16);
*p++ = i64c(x >> 22);
} while (--cnt);
More information about the busybox-cvs
mailing list