Talk:Clock drift
From Wikipedia, the free encyclopedia
[edit] Code example
The example of "pseudo code" is not, I would suggest, psuedo code. It is more like actual code. I can't tell which language it's from, but it's not that easy to follow if you don't know the particular language. It should be re-cast as true pseudo code. Arcturus 10:40, 29 July 2006 (UTC)
- Well, this is Wikipedia. Be bold and fix it! Don't ask others to fix it. And yes, I just typed down the first code that came to mind and focused more on correctness of that code than making it very easy to read. We should probably change the C-style for-loop to a while loop or even plain english or so, as I did with the inner loop. In my first version that inner loop too was a C-style for-loop. I was thinking of writing a description in plain english too, and having the "pseudocode" look more like actual code as it does now. So I think there are several ways to go: Either have a very easy to read pseudocode, or have plain english + a code example in for instance C or perhaps just a code example in C but with very good comments? I haven't done either yet since I need to think about it for some days.
- Besides, in a real system we usually do not do the modulo 256 since that would be a waste since the higher bits also contain some randomness. (Especially in the first round since that varies from zero to "average loop value" due to the first round starting anywhere in the middle of a tick.) Instead usually we put the full 32-bit loop values in the array and when finished we hash the whole array down to one 256-bit value. Note that the hash method used need not be a secure one, any "compression function" with a good avalanche effect is good enough. Hash functions just happens to be such compression functions. But I wanted to keep the example as easy as possible so I used modulo instead of hashing.
- So there are some thinking and discussion to do about how to best show how to do clock drift measuring.
- --David Göthberg 17:29, 29 July 2006 (UTC)