From: Roland Häder Date: Fri, 22 Feb 2013 05:34:42 +0000 (+0000) Subject: Now correct class :( X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9171faffa5f44a149660fb81a626e09a8b460672;p=hub.git Now correct class :( --- diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 898f925d7..4156847bb 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -115,8 +115,8 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @todo Make this code more generic and move it to CryptoHelper or */ protected function generateRamdomString ($length) { - // Get an RNG instance - $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); +// Get an RNG instance +$rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); // Generate a pseudo-random string $randomString = $rngInstance->randomString($length) . ':' . $this->getBootIpPort() . ':' . $this->getRequestInstance()->getRequestElement('mode'); @@ -135,8 +135,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { * @return void */ private function generatePrivateKeyAndHash (LocalSearchCriteria $searchInstance) { + // Get an RNG instance + $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); + // Generate a pseudo-random string - $randomString = $this->getCryptoInstance()->randomString(255); + $randomString = $rngInstance->randomString(255); // Hash and encrypt the string so we become a node id (also documented as "hub id") $this->setPrivateKey($this->getCryptoInstance()->encryptString($randomString)); @@ -285,8 +288,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable, AddableCriteria { // Output message self::createDebugInstance(__CLASS__)->debugOutput('BOOTSTRAP: Re-using found node-id: ' . $this->getNodeId() . ''); } else { + // Get an RNG instance + $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class'); + // Generate a pseudo-random string - $randomString = $this->getCryptoInstance()->randomString(255); + $randomString = $rngInstance->randomString(255); // Hash and encrypt the string so we become a node id (also documented as "hub id") $this->setNodeId($this->getCryptoInstance()->hashString($this->getCryptoInstance()->encryptString($randomString)));