Streamable and for encryption added, CryptoHelper (a facade) rewritten to use streams
[core.git] / inc / classes / main / rng / class_RandomNumberGenerator.php
index fd41643..27a3672 100644 (file)
@@ -174,6 +174,24 @@ class RandomNumberGenerator extends BaseFrameworkSystem {
        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]