浏览代码

[Web] Use preg_replace to detect passwd schema case-insensitive, sorry for wasting some ms cpu time

André 7 年之前
父节点
当前提交
de00654a0a
共有 1 个文件被更改,包括 1 次插入3 次删除
  1. 1 3
      data/web/inc/functions.inc.php

+ 1 - 3
data/web/inc/functions.inc.php

@@ -130,9 +130,7 @@ function generate_tlsa_digest($hostname, $port, $starttls = null) {
 }
 function verify_ssha256($hash, $password) {
 	// Remove tag if any
-  if (substr($hash, 0, strlen('{SSHA256}')) == '{SSHA256}') {
-    $hash = substr($hash, strlen('{SSHA256}'));
-  }
+  $hash = preg_replace('/^{SSHA256}/i', '', $hash);
 	// Decode hash
 	$dhash = base64_decode($hash);
 	// Get first 32 bytes of binary which equals a SHA256 hash