On Thursday 12 July 2007 18:10, Mihai Maties wrote:
> > ce e ala djb-style? :D
>
> Adica sa iei valori random bazandu-te pe PID-ul procesului curent... etc
>
> Sau cum bine a zis-o chiar Linus Torvalds
> (http://lkml.org/lkml/2004/6/6/9):
>
> <--- cut here --->
> qmail is a piece of crap. The source code is completely unreadable, and it
> seems to think that "getpid()" is a good source of random data. Don't ask
> me why.
>
> It literally does things like
>
> random = now() + (getpid() << 16);
>
> and since there isn't a single comment in the whole source tree, it's
> pointless to wonder why. (In case you wonder, "now()" just does a
> "time(NULL)" call - whee.).
>
> I don't understand why people bother with it. It's not like Dan Bernstein
> is so charming that it makes up for the deficiencies of his programs.
> </--- cut here --->
Comentariul lui Linus e luat din context. Btw, nu e nimic gresit in a folosi
getpid() pt random data. Depinde de nevoile de random. Daca ai nevoie de
random sa generezi chei de criptare pt nave spatiale probabil ca e cam stupid
sa folosesti getpid() dar daca ai nevoie de o valoare relativ random (poate
sa nu fie random) atunci e OK. Ba chiar e o metoda mai buna (ie mai rapida)
decat chestii bazate /dev/(u)random.
Si sa nu-mi spui ca tu nu te-ai prins instant ce face "now()"...
Coding style-ul nu este unul foarte lizibil, pe de alta parte nici nu are de
ce sa fie. Nu e open source software facut pt mentenanta si extindere, pt a
atrage persoane interesate sa modifice. E facut doar ca sa-l inteleaga DJB si
pt el banuiesc ca e OK asa cum e.
--
Mihai RUSU Email: [EMAIL PROTECTED]
"Linux is obsolete" -- AST
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug