aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/passwords
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2014-10-22 14:54:22 -0500
committerMarc Alexander <admin@m-a-styles.de>2014-10-22 14:54:22 -0500
commit2b47ef1266a04ae0bf692a1568687968e8e2b827 (patch)
tree9ed4ba519fe1223ed37ddc1bda6176dcdc46536a /phpBB/phpbb/passwords
parente43d1781bf17c9265f075dfc0cc38d807fe3b70e (diff)
downloadforums-2b47ef1266a04ae0bf692a1568687968e8e2b827.tar
forums-2b47ef1266a04ae0bf692a1568687968e8e2b827.tar.gz
forums-2b47ef1266a04ae0bf692a1568687968e8e2b827.tar.bz2
forums-2b47ef1266a04ae0bf692a1568687968e8e2b827.tar.xz
forums-2b47ef1266a04ae0bf692a1568687968e8e2b827.zip
[ticket/13203] Add method for byte by byte comparison to drivers helper
PHPBB3-13203
Diffstat (limited to 'phpBB/phpbb/passwords')
-rw-r--r--phpBB/phpbb/passwords/driver/helper.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/phpBB/phpbb/passwords/driver/helper.php b/phpBB/phpbb/passwords/driver/helper.php
index 2b3ebce53a..caa65080ac 100644
--- a/phpBB/phpbb/passwords/driver/helper.php
+++ b/phpBB/phpbb/passwords/driver/helper.php
@@ -142,4 +142,24 @@ class helper
}
return $random;
}
+
+ /**
+ * Compare two strings byte by byte
+ *
+ * @param string $string_a The first string
+ * @param string $string_b The second string
+ *
+ * @return bool True if strings are the same, false if not
+ */
+ public function string_compare($string_a, $string_b)
+ {
+ $difference = strlen($string_a) != strlen($string_b);
+
+ for ($i = 0; $i < strlen($string_a) && $i < strlen($string_b); $i++)
+ {
+ $difference |= $string_a[$i] != $string_b[$i];
+ }
+
+ return $difference === 0;
+ }
}