if (strlen($str) > 40) {
// The string is to long
return $str;
- } elseif (strlen($str) == 40) {
+ } elseif ((strlen($str) == 40) && (getPassScramble() != '')) {
// From database
- $scrambleNums = explode(':', getPassScramble());
+ $scramble = getPassScramble();
} else {
// Generate new numbers
- $scrambleNums = explode(':', genScrambleString(strlen($str)));
+ $scramble = genScrambleString(strlen($str));
}
+ // Convert it into an array
+ $scrambleNums = explode(':', $scramble);
+
// Assert on both lengths
assert(strlen($str) == count($scrambleNums));