• Subject: Re: AS/400 entropy source
  • From: "Leif Svalgaard" <leif@xxxxxxxx>
  • Date: Wed, 29 Nov 2000 23:14:23 -0600

From: Tim McCarthy <timm@as400ftp.com>

> But I'm really looking for something that would develop
> the seed for random number generation rather than the number generation
> itself (the crypto-geeks get all bent out of shape when you use pseudo
> random number generators without at least providing a seed that was
> generated from machine noise or random mouse movements). I just thought
> there might be a (hidden) function that could capture something like
> random memory values over a period and provide that as input.

Tim, the MI-program below YIELDS its timeslice 50000 times
and times the REAL time that takes. This is very dependent
on the overall machine activity. Here are the results for 20 runs
during a very quiet period. These numbers are the equivalent 
of mouse movements and seem pretty random; they can be
further massaged by xoring with all kinds of other stuff, or 
computing the remainder after dividing by a large prime,
etc:

Variable  . . . . . . . . . . . . . . . : DIFFS                 
  Lower/upper bounds  . . . . . . . . . :   (1:20)              
  Type  . . . . . . . . . . . . . . . . :   PACKED              
  Length  . . . . . . . . . . . . . . . :   21 0                
  Element     ----------------------Values----------------------
          1  '            4261478400'  '            3840180224' 
          3  '            3818651648'  '            3854860288' 
          5  '            4288741376'  '            4778950656' 
          7  '            3871735808'  '            4795891712' 
          9  '            3949395968'  '            4330782720' 
        11  '            3864100864'  '            3821076480'
        13  '            3768254464'  '            3871571968'
        15  '            4225335296'  '            4080402432'
        17  '            3981180928'  '            4030758912'
        19  '            3975938048'  '            4744708096'

DCL DD TIME-TIMES CHAR(24) BDRY(8);                                   
    DCL DD TIME-BEFORE       CHAR(8) DEF(TIME-TIMES) POS( 1);         
    DCL DD TIME-AFTER        CHAR(8) DEF(TIME-TIMES) POS( 9);         
    DCL DD TIME-DIFFERENCE   CHAR(8) DEF(TIME-TIMES) POS(17);         
                                                                      
DCL DD TIME-DIFF-HI   BIN(4) UNSGND DEF(TIME-DIFFERENCE) POS(1);      
DCL DD TIME-DIFF-LO   BIN(4) UNSGND DEF(TIME-DIFFERENCE) POS(5);      
                                                                      
DCL DD TIMESTAMP  PKD(21,0);                                          
DCL DD TWO**32    PKD(11,0) INIT(P'4294967296');                      
                                                                      
DCL DD MACHINE-CLOCK CHAR(2) INIT(X'0100');                           
DCL SPCPTR .MACHINE-ATTR INIT(MACHINE-ATTR);                          
DCL DD      MACHINE-ATTR CHAR(16) BDRY(16);                           
    DCL DD  MAT-MAX-SIZE   BIN(4) DEF(MACHINE-ATTR)  POS( 1) INIT(16);
    DCL DD  MAT-ACT-SIZE   BIN(4) DEF(MACHINE-ATTR)  POS( 5);         
    DCL DD  MAT-TIMESTAMP CHAR(8) DEF(MACHINE-ATTR)  POS( 9); 
                                                              
DCL DD DIFFS(20) PKD(21,0);                                   
DCL DD N BIN(2);                                              
DCL DD Y BIN(4);                                              
                                                              
    CPYNV       N, 20;                                        
GET-NEXT-RANDOM:                                              
    MATMATR    .MACHINE-ATTR, X'0100';                        
    CPYBLA      TIME-BEFORE, MAT-TIMESTAMP;                   
    CPYNV       Y, 50000;                                     
LOOP:                                                         
    YIELD;                                                    
    SUBN(SB)    Y, 1/HI(LOOP);                                
                                                              
    MATMATR    .MACHINE-ATTR, X'0100';                        
    CPYBLA      TIME-AFTER , MAT-TIMESTAMP;                   
    SUBLC       TIME-DIFFERENCE, TIME-AFTER, TIME-BEFORE;  
    MULT        TIMESTAMP, TIME-DIFF-HI, TWO**32;          
    ADDN(S)     TIMESTAMP, TIME-DIFF-LO;                   
    CPYNV       DIFFS(N), TIMESTAMP;                       
    SUBN(SB)    N, 1/HI(GET-NEXT-RANDOM);                  
                                                           
    BRK "1";                                               
    RTX         *;                                         



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].