## 2 VDES Data Link Credibility Monitoring Approach
### Radio Interference Detection Based on Message Characteristics
#### 2.1.1 VDES Message Integrity Verification Method Based on the MD5 Algorithm
The module compared a message received by a VDES base station at that time: \"IAVEM,1,1,0,A,403 sooQvMSfR0 JAhH=Tdp400D0E,0*5D\", with a legitimate message previously sent by ships and stored in the VDES original message database: \"IAVEM,1,1,0,A,403f?i1 vLohh<'dD=LF7M3U00D0G,0*0A\". The verification results are illustrated in Figure 20.2

Figure 20.3 Functionality verification results for the VDES message integrity module. ```
Step 1: Connect database  severe = (local); database = DBTESTB; integrated security = true Step 2: Calculate hash value functionCALCULATEHASH(data) usingMD5 md5 = MD5.Create()  hashBytes \(\leftarrow\) md5.ComputeHash(Encoding.UTF8.GetBytes(data)) returnBitConverter.ToString(hashBytes).Replace(\"-\", \"\") endfunction Step 3: Message integrity verification vdesMessage \(\leftarrow\) concatenatedValuesValues(time \(\leftarrow\) Join values11 and replace spaces ProcessVDESMessage1(vdesMessage) dataBlocksForMessage1 \(\leftarrow\) new List() ProcessVDESMessage2(valuesString) dataBlocksForMessage2 \(\leftarrow\) new List() hashValue1 \(\leftarrow\) CalculateHash(Join dataBlocksForMessage1) hashValue2 \(\leftarrow\) CalculateHash(Join dataBlocksForMessage2) areHashesEqual \(\leftarrow\) hashValue1 = = hashValue2 if areHashesEqual then  shuchu1 \(\leftarrow\) \"The hash values of the two VDES messages are the same. Data integrity verification passed.\" else  shuchu1 \(\leftarrow\) \"The hash values of the two VDES messages are different. Data integrity verification failed.\" endif Step 4: Message consistency verification function computeHMAC(data, key) usingHMACMD5 hmac = new HMACMD5(Encoding.UTF8.GetBytes(key)) hashBytes \(\leftarrow\) hmac.ComputeHash(Encoding.UTF8.GetBytes(data)) returnBitConverter.ToString(hashBytes).Replace(\"-\", \"\").ToLower() endfunction data1 \(\leftarrow\) TDB Message vdesMessage \(\leftarrow\) data1[5] sharedKey \(\leftarrow\) Substring(0,7) of data1[5] generatedHMAC1 \(\leftarrow\) ComputeHMAC(vdesMessage, sharedKey) ReceivedVdes.Split(\",) receivedVdes\(\leftarrow\) data [5] generatedHMAC2 \(\leftarrow\) ComputeHMAC(receivedVdes, sharedKey) if generatedHMAC1 = = generatedHMAC2 then  shuchu2 \(\leftarrow\) \"Data consistency validation passes!\" else  shuchu2 \(\leftarrow\) \"Data consistency validation failed!\" endif
```
**Algorithm 3** VDES message integrity and consistency monitoring

As shown in Figure 31, the VDES base station received a VDES message with a hash value of BAD622E5998 CBB2312778 DFF79A8B1C0, while the hash value of the legitimate message from the VDES original message database was 26E7 EFD14C83B4B7 EF67A142 ED4 1 ED0. The discrepancy between these two hash values indicates that the VDES message was affected by radio interference, leading to incomplete message content and confirming the functionality of the VDES message integrity verification module. To validate the functionality of the VDES message consistency verification module, a scenario was set in which a link management message was broadcast by a VDES base station using the TDB statement \"IABTDB,1,1,0,A,403t?]!vLohh<JAHH=Tdp500D0G,0*6E\". This message was then received by a VDES ship station, automatically forwarded using the VEM statement, and subsequently re-received by the VDES base station as: \"IAVEM,1,1,0,A,403 sooQvMSfR0W'0B4@qWO400D0E,0*33\". The consistency of these two messages was verified, with the results presented in Figure 20.4

As depicted in Figure 32, the HMAC value of the message broadcast by the VDES base station using the TDB statement was ada57b53e64a11 deae45 ffadb3 eaf392, while the HMAC value of the VEM statement message, relayed by the ship station and then re-received by the VDES base station, was 5c8980420b23 cc80990d3f31c5478c59. The discrepancy in these HMAC values indicates that the VDES message was compromised by radio interference at that moment, leading to alterations in the message content. This module successfully fulfills the functionality of the VDES message consistency verification module.