* 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;