## 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
Therefore, it is essential to verify the consistency of the content between the link management messages broadcast by the VDES base station in TDB format and the messages received again by the base station after being relayed. The Hash-based Message Authentication Code (HMAC) is a message authentication code that utilizes a hash function as part of its authentication algorithm. In wireless communication, the HMAC algorithm is employed to verify data integrity, playing a crucial role in safeguarding data security and preventing tampering. The HMAC algorithm generates HMAC values by combining a key with VDES messages. By comparing the HMAC value of the link management messages broadcast in TDB format with the HMAC value of the messages received via VEM statements, any discrepancies in the HMAC values indicate content tampering due to radio interference during transmission. Thus, comparing the HMAC values of TDB and VEM messages allows for the verification of data integrity in the transmission of messages between VDES base stations. The process flow diagram of the HMAC algorithm is illustrated in Figure 8.

As crucial fields of the VDES message, such as the MMSI code and message ID, are contained within the first 7 characters of the message, this paper utilizes these characters as the shared key. Subsequently, this key, along with the VDES message, serves as input for the HMAC algorithm. The specific computation process for HMAC is outlined as follows:

Step 1: Input the key k and the VDES message. Step 2: Pad the key k to obtain a new key, str. Initially, preprocess the key length; if the key length is less than 64 bytes, append zeros to extend it to 64 bytes, forming the new key str. If the key length exceeds 64 bytes, utilize the hash value of key k as the new key k, then append zeros to the hash value until it reaches 64 bytes, resulting in the new key str. Step 3: Perform internal hash operations. XOR the new key str obtained in Step 2 with the hexadecimal constant ipad (i.e., 0X36) to derive the string k1. Append the VDES message to the string k1 and hash the concatenated result to generate HMAC1. Step 4: XOR the new key str obtained in Step 2 with the hexadecimal constant opad (i.e., 0X5c) to obtain the string k2. Append HMAC1 to k2 and hash the combined result to produce the final HMAC value for the VDES message. Following these procedures, calculate the HMAC value for the link management messages broadcast by the VDES base station in TDB format and for the messages received again by the base station after being automatically relayed by VDES ship stations using VEM statements. If the two values match, it indicates that the VDES message remained unaffected by radio interference in the data link, ensuring message integrity verification. Conversely, if the values differ, it suggests that radio interference during transmission led to inconsistencies in the message content. By employing these criteria, consistency checks for the transmission of messages between VDES base stations can be facilitated. Building upon the verification of data integrity in VDES messages, potential radio interference in the VDES data link can be detected by assessing the consistency of message exchanges between base stations. In this section, the VDES base station broadcasts link management messages in TDB format, such as \"IABTDB,1,1,0,A,403 sooQvMSfR0W'0B4@qWO4 00D0E,0\"34\". After being automatically relayed by ship stations using VEM statements, this message was received again by the VDES base station as \"IAVEM,1,1,0,A,403 sooQvMSfR0'J AhH=Tdp400D0E,0\"5D\". The HMAC algorithm was employed to calculate the HMAC values of these two messages, revealing the consistency of message exchange between VDES base stations, as depicted in Figure 9.

Figure 8: Diagram of the HMAC algorithm computation process. The simulation environments in Figure 9 employs the C# language within Visual Studio 2019 in Windows11 operating system environment.