Changeset 3446


Ignore:
Timestamp:
Nov 21, 2012, 12:10:28 AM (2 years ago)
Author:
wmb
Message:

oatstime utility - simplified the fix in svn 3445 by observing that running one step of a linear congruence adds no entropy to the seed value, thus you might as well just use the seed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpu/x86/pc/olpc/oatstime.fth

    r3445 r3446  
    317317   " flush-writes" $call-http
    318318;
    319 [ifndef] random-long
    320 variable rn
    321 : random-long  rn @  d# 1103515245 *  d# 12345 +   h# 7FFFFFFF and  dup rn !  ;
    322 time&date >unix-seconds get-msecs xor rn !
     319
     320[ifdef] random
     321alias nonce-int random-long
     322[else]
     323: nonce-int  ( -- n )  time&date >unix-seconds get-msecs xor  ;
    323324[then]
     325
    3243260 value the-nonce
    325327: oats-msg$  ( -- msg$ )
    326    random-long abs  dup to the-nonce   ( nonce )
     328   nonce-int abs  dup to the-nonce   ( nonce )
    327329   " SN" find-tag 0= abort" Machine has no serial number" ?-null  ( nonce sn$ )
    328330   " serialnum=%s&version=1&nonce=%d" sprintf
Note: See TracChangeset for help on using the changeset viewer.