]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/crypto/class_CryptoHelper.php
rngInstance is now located in BaseFrameworkSystem
[core.git] / inc / classes / main / crypto / class_CryptoHelper.php
index 2335f5dc5a534855c556de2034d315fe8b2c1206..c135b18971cdf4bb0f75d154d24d5c212765b678 100644 (file)
@@ -105,7 +105,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                // Do we have mcrypt loaded?
                if ($this->isPhpExtensionLoaded('mcrypt')) {
                        // Then use it
-                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('McryptStream', array($this->rngInstance()));
+                       $this->cryptoStreamInstance = ObjectFactory::createObjectByName('McryptStream', array($this->getRngInstance()));
                } else {
                        // If nothing works ...
                        $this->cryptoStreamInstance = ObjectFactory::createObjectByName('NullCryptoStream');
@@ -119,7 +119,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         */
        protected function initHasher () {
                // Initialize the random number generator which is required by some crypto methods
-               $this->rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
+               $this->setRngInstance(ObjectFactory::createObjectByConfiguredName('rng_class'));
 
                // Generate a salt for the hasher
                $this->generateSalt();
@@ -132,7 +132,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         */
        private function generateSalt () {
                // Get a random string from the RNG
-               $randomString = $this->rngInstance->randomString();
+               $randomString = $this->getRngInstance()->randomString();
 
                // Get config entry for salt length
                $length = $this->getConfigInstance()->getConfigEntry('salt_length');
@@ -171,7 +171,7 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
                //* DEBUG: */ echo "salt=".$salt."/plain=".$str."<br />\n";
                $hashed = $salt . md5(sprintf($this->getConfigInstance()->getConfigEntry('hash_mask'),
                        $salt,
-                       $this->rngInstance->getFixedSalt(),
+                       $this->getRngInstance()->getFixedSalt(),
                        $str
                ));