Random.st
changeset 4198 0577571b74da
parent 3781 36ed064deb4e
child 4481 7785f5a3c411
child 4769 89914ccfcf7d
equal deleted inserted replaced
4197:51449951faf2 4198:0577571b74da
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2 ======================================================================
     4 ======================================================================
     3 |
     5 |
     4 | Copyright (C) 1988, 1989 Free Software Foundation, Inc.
     6 | Copyright (C) 1988, 1989 Free Software Foundation, Inc.
     5 | Written by Steve Byrne.
     7 | Written by Steve Byrne.
   307         nextPut:RandomSalt;
   309         nextPut:RandomSalt;
   308         nextPut:Time microsecondClockValue; 
   310         nextPut:Time microsecondClockValue; 
   309         nextPut:OperatingSystem getProcessId; 
   311         nextPut:OperatingSystem getProcessId; 
   310         nextPut:(ObjectMemory addressOf:Object new); 
   312         nextPut:(ObjectMemory addressOf:Object new); 
   311         nextPut:ObjectMemory oldSpaceUsed; 
   313         nextPut:ObjectMemory oldSpaceUsed; 
   312         nextPut:ObjectMemory newSpaceUsed. 
   314         nextPut:ObjectMemory newSpaceUsed; 
   313     [
   315         nextPut:OperatingSystem getCPUCycleCount. 
   314         hash nextPut:OperatingSystem getCPUCycleCount. 
       
   315     ] on:PrimitiveFailure do:[].
       
   316 
   316 
   317     "/ any other cheap sources of entropy?
   317     "/ any other cheap sources of entropy?
   318 
   318 
   319     "/ I think there is no problem in that MD5 is not a secure hash algo here - the idea is to shuffle the bits around a bit
   319     "/ I think there is no problem in that MD5 is not a secure hash algo here 
       
   320     "/ - the idea is to shuffle the bits around a bit
   320     "/ (because the numbers above usually have many high bits in common)
   321     "/ (because the numbers above usually have many high bits in common)
   321     "/ and then condense the bits into a smaller number.
   322     "/ and then condense the bits into a smaller number.
   322     "/ Any comment from a crypto guy here - I am willing to change this to some other hash, if that makes a problem
   323     "/ Any comment from a crypto guy here - I am willing to change this to some other hash, if that makes a problem
   323 
   324 
   324     "/ Seeding rnd generators should take some bits from the returned number (i.e. their max. seed size)
   325     "/ Seeding rnd generators should take some bits from the returned number (i.e. their max. seed size)