Ignore:
Timestamp:
Apr 16, 2009, 10:43:02 AM (15 years ago)
Author:
Christoph Mayer
Message:

-rand seeding in StartupWrapper gezogen
-bessere rands für identifier

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/types/Identifier.cpp

    r2457 r2801  
    598598
    599599        //as mpn_random has no seeding function
    600         // we mess aroung here a little to achive randomness
     600        // we mess aroung here a little to achive some randomness
     601        // using the rand function that _is_ seeded in the
     602        // StartupWrapper::initSystem function
     603
    601604        Identifier keyRandom = ZERO;
    602605        mpn_random(keyRandom.key, aSize);
    603         Identifier keyTime( time(NULL) );
    604         mpn_mul_1( newKey.key, keyRandom.key, aSize, *keyTime.key );
     606        Identifier keyrnd( rand() );
     607        mpn_mul_1( newKey.key, keyRandom.key, aSize, *keyrnd.key );
    605608
    606609        newKey.trim();
     
    608611}
    609612
    610 
    611 // README: due to some problems with serialization the keylength
    612 // was changed to 192 bit! As none of the hashing functions
    613 // can provide 160 bit output, and we currently don't use any
    614 // hashing for identifiers in the demo at all ... this is all commented out!!
    615 
    616 
    617 // generate sha1 hash
    618613Identifier Identifier::sha1(const string& input) {
    619614        Identifier newKey;
     
    652647}
    653648
    654 
    655 
    656649// generate a key=2**exponent
    657650Identifier Identifier::pow2(uint exponent) {
Note: See TracChangeset for help on using the changeset viewer.