protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Clean up a little
- $this->removeNumberFormaters();
- $this->removeSystemArray();
}
/**
// 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
));
*/
public function encryptString ($str) {
// Encrypt the string through the stream
- $encryted = $this->cryptoStreamInstance->encryptStream($str);
+ $encrypted = $this->cryptoStreamInstance->encryptStream($str);
// Return the string
return $encrypted;