]> git.mxchange.org Git - core.git/blobdiff - inc/classes/main/crypto/class_CryptoHelper.php
Added 'abstract' to the class because doExecute() is abstract, too.
[core.git] / inc / classes / main / crypto / class_CryptoHelper.php
index 770224cb0f903e827458eb76faca5e1f2c19a0d3..f377a575a1af45ce8e22804dc81547a973b6b6dc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Core Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -31,11 +31,6 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         */
        private static $selfInstance = null;
 
-       /**
-        * Instance of the random number generator
-        */
-       private $rngInstance = null;
-
        /**
         * Instance of the crypto stream
         */
@@ -179,11 +174,12 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
         * Encrypt the string with fixed salt
         *
         * @param       $str            The unencrypted string
+        * @param       $key            Optional key, if none provided, a random key will be generated
         * @return      $encrypted      Encrypted string
         */
-       public function encryptString ($str) {
+       public function encryptString ($str, $key = null) {
                // Encrypt the string through the stream
-               $encrypted = $this->cryptoStreamInstance->encryptStream($str);
+               $encrypted = $this->cryptoStreamInstance->encryptStream($str, $key);
 
                // Return the string
                return $encrypted;