## 3 The Proposed Key Generation Protocol
### Information Reconciliation and Privacy Amplification  
Due to the unique characteristics of ship communications and AIS equipment, channel probing is a key focus, while the subsequent steps of key generation remain relatively fixed. Since binary bits are required as the input for key generation, both parties adopt the same quantization algorithm during the quantization stage to convert the sampled values into binary sequences \(K_{A}\) and \(K_{B}\). However, due to the incomplete reciprocity caused by half-duplex communication and environmental factors, \(K_{A}\) and \(K_{B}\) are often similar but not identical. The purpose of information reconciliation is to correct the discrepancies in the quantization sequences without leaking key bits, thereby ensuring consistency in the keys generated by both parties. In our proposed scheme, we utilize low-density parity-check (LDPC) codes, which offer excellent error correction performance, particularly when operating near the Shannon limit, making them highly suitable for low-SNR environments [30]. Algorithm 1 outlines the process for generating consistent key bit strings.  
Although it was proven that [PERSON] cannot eavesdrop on any useful information during the channel probing phase, some information may still be leaked to [PERSON] during the information reconciliation phase, as [PERSON] and [PERSON] exchange data to correct errors (e.g., exchanged checksums). Studies have shown that LDPC-based information reconciliation can leak more than 10% of the information to eavesdroppers [30]. To address this, privacy amplification employs a hash function to remap the verified sequence, thereby eliminating the adverse effects of information leakage.  
However, a key issue remains unresolved: the length of the generated key is determined by the encryption algorithm used by the communicating parties, and this length may not necessarily match the length of the sequence produced by the hash function. If the hash function output exceeds the required key length, truncating the hash value could  
\begin{table}
\begin{tabular}{c c c c} \hline \(K\) & \(e(k)\) & \(\mathbf{c_{1}(k)}\) & \(\mathbf{c_{2}(k)}\) \\  
compromise security. Conversely, if the output is shorter, padding (e.g., using the Merkle-Damgard bit padding algorithm) becomes necessary, which introduces additional overhead. To address this, this paper selects BLAKE2 as the hash function for privacy amplification during the simulation phase. Compared to SHA-3, which also supports variable output lengths, BLAKE2 offers a more streamlined and efficient algorithmic structure, providing significant advantages in both speed and deployment. These attributes are especially crucial for resource-constrained AIS devices.  
```
0:\(K_{A},K_{B},H,G,max\_iterations\)
0:\(K_{aligned}\)
1: Initialize parity-check matrix \(H\) and generator matrix \(G\)
2: Encode [PERSON]'s key \(K_{A}\) using \(H\): \(C_{A}=H(K_{A})\)
3: Transmit syndrome \(S_{A}\) from [PERSON] to [PERSON]
4: [PERSON] calculates the syndrome difference: \(S_{B}=H(K_{B})\)
5: Compute error syndrome: \(e=S_{A}-S_{B}\)
6: Initialize iteration count \(i=0\)
7:while\(e\
eq 0\) and \(i<max\_iterations\)do
8: Perform belief propagation decoding using \(G\)
9: Upgrade \(K_{B}\)
10: Recompute \(e=S_{A}-H(K_{B})\)
11:\(i=i+1\)
12:endwhile
13:if\(e==0\)then
14:\(K_{aligned}=K_{B}\)
15:else
16: Reconciliation failed, restart or abort
17:endif
18:return\(K_{aligned}\) or failure signal
```  
**Algorithm 1** LDPC-based information reconciliation