0) { $padded .= str_repeat('=', 4 - $remainder); } $binary = base64_decode($padded, true); if (!is_string($binary) || !hash_equals($encoded, self::base64url_encode($binary))) { unset($binary); throw new RuntimeException('Encoded credential data is invalid.'); } return $binary; } private static function derive_key($salt) { $context = self::PURPOSE . ':blog:' . (string) get_current_blog_id(); $key = hash_hkdf('sha256', wp_salt('auth'), 32, $context, $salt); if (!is_string($key) || strlen($key) !== 32) { unset($key); throw new RuntimeException('Credential key derivation failed.'); } return $key; } }