]> git.mxchange.org Git - hub.git/commitdiff
Now correct class :(
authorRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 05:34:42 +0000 (05:34 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 22 Feb 2013 05:34:42 +0000 (05:34 +0000)
application/hub/main/nodes/class_BaseHubNode.php

index 898f925d793f2a523ff881615c312cbf4ae86b28..4156847bb09cd6c04f96043c88f5496bb50d4290 100644 (file)
@@ -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)));