## 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
```
procedureMESSAGE-ENCAPSSULATION(sender,e) StringDecimalToBinary(int decimalNumber,intLength) returnbinaryNumber \"\"\" StringfinalMessage \(\leftarrow\)\"\"\" Stringstrr \(\leftarrow\) \"\"\" Stringid \(\leftarrow\) ID switch(Convert.Tolnt32(id)) case4: //When the id is 4, the string value is obtained from the input and a series of processing is performed end switch intsrl \(\leftarrow\) strr.Length intzerosToAdd \(\leftarrow\) 0 if(srl % 6 \(\
eq\) 0) zerosToAdd \(\leftarrow\) 6 -(srl % 6) strr \(\leftarrow\) strr + new string(\"0\", zeresToAdd) intSize \(\leftarrow\) 6 intnums \(\leftarrow\) strr.Length/Size StringbinaryChunkk[nums] fori \(\leftarrow\) 0 to nums do binaryChunkk[i] \(\leftarrow\) strr.Substring(i * Size, Size) endfor forallbinaryChunk in binaryChunkkdo intasciiValue \(\leftarrow\) Convert.Tolnt32(binaryChunk,2) ifasciiValue < 0x28 then  asciiValue \(\leftarrow\) asciiValue + 0x30  finalMessage \(\leftarrow\) finalMessage + Convert.ToChar(asciiValue) else ifasciiValue < 0x80 then  asciiValue \(\leftarrow\) asciiValue + 0x38  finalMessage \(\leftarrow\) finalMessage + Convert.ToChar(asciiValue) else  asciiValue \(\leftarrow\) 0 finalMessage + Convert.ToChar(asciiValue) endif endfor VDES_Message \(\leftarrow\) finalMessage intCalculateChecksun(String sentence) returnConvert.ToInt32(checksun.ToString(\"X2\"),16) Stringst \(\leftarrow\) TextBox22.Text + finalMessage + \",\" + zerosToAdd  Console.WriteLine(\"Checksun: \" + st) intccc \(\leftarrow\) CalculateChecksun(st) endprocedure
```
**Algorithm 2** VDES message encapsulation algorithm

To validate the functionality of the VDES message encapsulation module, a message ID of 4, a forwarding indicator of 0, UTC time set to 15 March 2023, at 16:48:12, position accuracy of 1, and electronic position-fixing device type 5 are utilized. Additionally, there are five time slots, 23 other stations currently received by this station, and all transmission control bits and RAIM flags are set to 0. The module encapsulates a base station with an MMSI code of 004132808 and position coordinates of (38\({}^{\circ}\)52.18692\({}^{\prime}\) N, 121\({}^{\circ}\)31.74228\({}^{\prime}\) E) into a VDES message compliant with the ITU-R M.2092 protocol standard. The resulting encapsulated message is: \"IABTDB,1,1,0,A,403t?1 vLohh<dD=LF?M3U00 DD0G,0*Oe\". As illustrated in Figure 28, this module successfully accomplishes the VDES message encapsulation functionality. #### (2) VDES Message Parsing

To acquire station, vessel dynamic, static, and navigational safety information from VDES messages, the VDES data link integrity monitoring system incorporates a VDES message parsing submodule, as illustrated in the UML diagram in Figure 19:6

As illustrated in Figure 29, during the VDES message parsing process, the received VDES message is first subjected to checksum computation using the CalculateChecksum() function. The computed checksum is then compared with the checksum extracted from the original message via the ExtractChecksum() function. If the checksums match, the

Figure 19:7 Functionality verification results for the VDES message encapsulation module. Figure 19:8 UML diagram for VDES message parsing. verification process is deemed successful; if not, verification fails, and an appropriate error message is generated. Upon successful verification, the ASCII codes in the message are converted to 6-bit binary codes using the Decode() function. Following the specific bit count regulations outlined in the ITU-R M.2092 international standard, grouping is performed using the DecodePayload() function. Finally, by utilizing the payloadDecoder.Decode() function, the grouped information is converted from binary to decimal, thereby revealing the parsed content of the VDES message. To validate the functionality of the VDES message parsing module, the message \":ABTDB1,1,1,0,A,403t? ]lvLohh<'dD=LF7M3U00D0G,0\"OE\" is parsed, with the results depicted in Figure 19:9

As depicted in Figure 30, the MMSI code of the VDES base station is 004132808.