*/
private $controllerInstance = null;
+ /**
+ * Instance of an RNG
+ */
+ private $rngInstance = null;
+
/**
* The real class name
*/
- private $realClass = 'FrameworkSystem';
+ private $realClass = 'BaseFrameworkSystem';
/**
* Thousands seperator
// Return result
return $isLoaded;
}
+
+ /**
+ * Setter for RNG instance
+ *
+ * @param $rngInstance An instance of a random number generator (RNG)
+ * @return void
+ */
+ protected final function setRngInstance (RandomNumberGenerator $rngInstance) {
+ $this->rngInstance = $rngInstance;
+ }
+
+ /**
+ * Getter for RNG instance
+ *
+ * @return $rngInstance An instance of a random number generator (RNG)
+ */
+ public final function getRngInstance () {
+ return $this->rngInstance;
+ }
}
// [EOF]
// 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');
*/
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();
*/
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');
//* 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
));
*/
private $helperInstance = null;
- /**
- * Instance of an RNG
- */
- private $rngInstance = null;
-
/**
* Protected constructor
*
*/
protected final function initializeRandomNumberGenerator (FrameworkInterface $extraInstance = null) {
// Get an RNG from factory
- $this->rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class', array($extraInstance));
- }
-
- /**
- * Getter for RNG instance
- *
- * @return $rngInstance An instance of a random number generator (RNG)
- */
- public final function getRngInstance () {
- return $this->rngInstance;
+ $this->setRngInstance(ObjectFactory::createObjectByConfiguredName('rng_class', array($extraInstance)));
}
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseStream extends BaseFrameworkSystem {
- /**
- * Random number generator instance (RNG)
- */
- private $rngInstance = null;
-
/**
* Protected constructor
*
$this->removeNumberFormaters();
$this->removeSystemArray();
}
-
- /**
- * Setter for RNG instance
- *
- * @param $rngInstance An RNG instance
- * @return void
- */
- protected final function setRngInstance (RandomNumberGenerator $rngInstance) {
- $this->rngInstance = $rngInstance;
- }
-
- /**
- * Getter for RNG instance
- *
- * @return $rngInstance An RNG instance
- */
- protected final function getRngInstance () {
- return $this->rngInstance;
- }
}
// [EOF]