Streamable and for encryption added, CryptoHelper (a facade) rewritten to use streams
[core.git] / inc / classes / main / rng / class_RandomNumberGenerator.php
index fd416433a52d49f55495d12fc8456d27ca92306c..27a3672817ce027c31f3cc2203e9b1539805c7a0 100644 (file)
@@ -174,6 +174,24 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
        public final function getFixedSalt () {
                return $this->fixedSalt;
        }
        public final function getFixedSalt () {
                return $this->fixedSalt;
        }
+
+       /**
+        * Generates a key based on if we have extra (default) or fixed salt enabled
+        *
+        * @return      $key    The generated key for encrypion
+        */
+       public function generateKey () {
+               // Default is extra salt
+               $key = md5($this->getExtraSalt());
+
+               // Get key
+               if ($this->getConfigInstance()->getConfigEntry('crypt_fixed_salt') == 'Y') {
+                       $key = md5($this->getFixedSalt());
+               } // END - if
+
+               // Return it
+               return $key;
+       }
 }
 
 // [EOF]
 }
 
 // [EOF]