## 3 Methodology
### Diving into Pairing Approach
#### 3.2.1 Pairing of ECUs and Validation of Data  
This section presents the details of our innovative ECU pairing approach designed to identify security threats without taxing the ECUs with extra memory or network traffic. Crucially important is the onboard central module, which uses machine-learning techniques for attack detection. Figure 2 shows how our ECU pairing model is implemented. The criteria we apply to choose the suitable ECUs for matching are briefly described below. Selecting ECUs for Pairing and Data Validation  
First, the choice of ECUs to pair starts with data compatibility. Each ECU is first evaluated to see whether it shares compatible, similar data with another ECU in the network, therefore ensuring smooth data flow between paired ECUs. The method guarantees that every ECU is unique, thereby prohibiting self-pairing, and takes ECU availability into account to prevent pairing units already engaged with others. Special pair IDs are assigned to stop simultaneous involvement in several pairings. ECUs are chosen for pairing in the design of the vehicle depending on their common use of particular sensor data, hence improving system security and dependability. For activities based on wheel speed sensor data, the Tyre Pressure Monitoring System (TPMS) might, for example, be combined with the Stability Control System (SCS) ECU. Aggregating redundant and complimentary sensor data from these linked ECUs allows for data cross-valuation. Data from the SCC ECU and TPMS is forwarded to the central module for data cross-validation. Analyzing data from both connected ECUs ensures reliability and precision, therefore facilitating the detection of anomalies or differences implying security breaches. This well-crafted pairing approach seeks to preserve data integrity, therefore strengthening the system's resistance to possible hazards resulting from erroneous data or sensor manipulation by threat actors. Figure 2: Flow of the proposed ECU pairing authentication model. By means of a module, the central validation of data greatly improves the control system security of the vehicle. ECUs are coupled based on their mutual need to exchange certain information. This method guarantees strong data validation, even when operational effectiveness is maintained. Whereas Algorithm 1 fully describes the pairing and data validation procedure, Figure 3 offers an abstract depiction of our ECU pairing concept. Each ECU is allocated a unique pair ID and ECU ID to ensure robust security since only two ECUs are linked to the network. Effective detection accuracy is enhanced by the good data comparison between connected ECUs enabled by this design, so the module efficiently follows these pair IDs to support data comparison. ```
1:Initialize an empty list called _pairedECUs_ to store the paired ECUs. 2:Initialize an empty dictionary called _pairIDs_ to store the pair ID for each ECU. 3:for each \(ECU_{i}\) in the network do
4: Set a flag variable _isPaired_ to False for \(ECU_{i}\). 5:for each \(ECU_{j}\) in the network do
6:if\(ECU_{i}\) and \(ECU_{j}\) exchange the same kind of information and \(ECU_{i}\
eq ECU_{j}\)then
7:if\(ECU_{i}\) and \(ECU_{j}\) are available for pairing and pairIDs\([ECU_{i}]\
eq\) pairIDs\([ECU_{j}]\)then
8: Set the flag variable _isPaired_ to True for \(ECU_{i}\) and \(ECU_{j}\). 9: Add \(ECU_{i}\) and \(ECU_{j}\) to the _pairedECUs_ list. 10: Assign a unique pair ID _pairID_ to the pair (\(ECU_{i}\), \(ECU_{j}\)). 11: Associate the pair ID with \(ECU_{i}\) and \(ECU_{j}\) in the _pairIDs_ dictionary. 12:endif
13:endif
14:endfor
15:for each _pairedECU_ in the _pairedECUs_ list do
16: Validate the second ECU data based on the first ECU's input in the pair using a validation function. 17:if the data are valid then
18: continue to the next pair
19:else
20: Attack is Detected. Remove the pair (\(ECU_{i}\), \(ECU_{j}\)) from the _pairedECUs_ list. 21: Update the _pairIDs_ dictionary accordingly.