Code merged from ship-simu repository
[mailer.git] / inc / classes / main / crypto / class_CryptoHelper.php
index 2ebafd8ed9c9dfdeffcda10ef4473645e620ccbc..0456e10dae2e1f8cb3c5a0929f9a1d7e66def337 100644 (file)
@@ -119,8 +119,8 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
        /**
         * Hashes a string with salt and returns the hash. If an old previous hash
         * is supplied the method will use the first X chars of that hash for hashing
-        * the password. This is useful if you want to check if the password is
-        * identical for authorization purposes.
+        * the password. This is useful if you want to check if password is identical
+        * for authorization purposes.
         *
         * @param       $str            Unhashed string
         * @param       $oldHash        A hash from previous hashed string
@@ -241,6 +241,11 @@ class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
 
                // Get the real string out
                $strArray = explode("|", $garbageString);
+
+               // Does the element count match?
+               assert(count($strArray) == 3);
+
+               // Decode the string
                $str = base64_decode($strArray[1]);
 
                // Trim trailing nulls away