1 /* vi: set sw=4 ts=4: */
5 * i64c was also put here, this is the only function that uses it.
7 * Lifted from loginutils/passwd.c by Thomas Lundquist <thomasez@zelow.no>
13 static int i64c(int i)
23 return ('A' - 12 + i);
24 return ('a' - 38 + i);
28 void crypt_make_salt(char *p, int cnt)
30 unsigned x = x; /* it's pointless to initialize it anyway :) */
32 x += getpid() + time(NULL) + clock();
34 /* x = (x*1664525 + 1013904223) % 2^32 generator is lame
35 * (low-order bit is not "random", etc...),
36 * but for our purposes it is good enough */
37 x = x*1664525 + 1013904223;
38 /* BTW, Park and Miller's "minimal standard generator" is
39 * x = x*16807 % ((2^31)-1)
40 * It has no problem with visibly alternating lowest bit
41 * but is also weak in cryptographic sense + needs div,
42 * which needs more code (and slower) on many CPUs */