MyBB Community Forums

Full Version: [HELP] Integrate MyBB With xAuth (Bukkit Plugin)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

in some post i readed than is possible to "delete" the md5(md5 .....); in members.php and/or function_user.php, i want to ask for PHP Advanced users to how to do integration with xAuth (this bukkit plugin use also MySQL, with "weird" cryptography). The php functions code is:

function checkPassword($checkPass, $realPass, $algorithm) {
	switch ($algorithm) {
	case 1:
		return $realPass == hash('whirlpool', $checkPass);
	case 2:
		return $realPass == hash('md5', $checkPass);
	case 3:
		return $realPass == hash('sha1', $checkPass);
	case 4:
		return $realPass == hash('sha256', $checkPass);
	default:
		// xAuth hashing
		$saltPos = (strlen($checkPass) >= strlen($realPass) ? strlen($realPass) : strlen($checkPass));
		$salt = substr($realPass, $saltPos, 12);
		$hash = hash('whirlpool', $salt . $checkPass);
		return $realPass == substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
	}
}

function encryptPassword($password) {
	$salt = substr(hash('whirlpool', uniqid(rand(), true)), 0, 12);
	$hash = hash('whirlpool', $salt . $password);
	$saltPos = (strlen($password) >= strlen($hash) ? strlen($hash) : strlen($password));
	return substr($hash, 0, $saltPos) . $salt . substr($hash, $saltPos);
}

Any 1 know how to integrate it?