<?php
// Own namespace
-namespace CoreFramework\Helper\Crypto;
+namespace Org\Mxchange\CoreFramework\Helper\Crypto;
// Import framework stuff
-use CoreFramework\Crypto\Cryptable;
-use CoreFramework\Factory\ObjectFactory;
-use CoreFramework\Object\BaseFrameworkSystem;
+use Org\Mxchange\CoreFramework\Crypto\Cryptable;
+use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
+use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem;
/**
* A helper class for cryptographical things like hashing passwords and so on
* @return void
*/
protected function attachCryptoStream () {
- // Do we have mcrypt loaded?
+ // @TODO Maybe rewrite this with DirectoryIterator, similar to Compressor thing?
+ // Do we have openssl/mcrypt loaded?
if ($this->isPhpExtensionLoaded('mcrypt')) {
// Then use it
- $this->cryptoStreamInstance = ObjectFactory::createObjectByName('McryptStream', array($this->getRngInstance()));
+ $this->cryptoStreamInstance = ObjectFactory::createObjectByName('Org\Mxchange\CoreFramework\Stream\Crypto\McryptStream', array($this->getRngInstance()));
+ } elseif ($this->isPhpExtensionLoaded('openssl')) {
+ // Then use it
+ $this->cryptoStreamInstance = ObjectFactory::createObjectByName('Org\Mxchange\CoreFramework\Stream\Crypto\OpenSslStream', array($this->getRngInstance()));
} else {
// If nothing works ...
- $this->cryptoStreamInstance = ObjectFactory::createObjectByName('NullCryptoStream');
+ $this->cryptoStreamInstance = ObjectFactory::createObjectByName('Org\Mxchange\CoreFramework\Stream\Crypto\NullCryptoStream');
}
}
$uuid = '';
// Is the UUID extension loaded and enabled? (see pecl)
- if ($this->getConfigInstance()->getConfigEntry('extension_uuid_loaded') === TRUE) {
+ if ($this->getConfigInstance()->getConfigEntry('extension_uuid_loaded') === true) {
// Then add it as well
$uuid = uuid_create();
} // END - if
* @param $withFixed Whether to include a fixed salt (not recommended in p2p applications)
* @return $hashed The hashed and salted string
*/
- public function hashString ($str, $oldHash = '', $withFixed = TRUE) {
+ public function hashString ($str, $oldHash = '', $withFixed = true) {
// Cast the string
$str = (string) $str;
// Hash the password with salt
//* DEBUG: */ echo "salt=".$salt."/plain=".$str."<br />\n";
- if ($withFixed === TRUE) {
+ if ($withFixed === true) {
// Use additional fixed salt
$hashed = $salt . md5(sprintf($this->getConfigInstance()->getConfigEntry('hash_extra_mask'),
$salt,