## 4 Proposed Security Algorithm for Patient Data in WBSN and IoMTs Applications
### Patient Information Recovery and Copyright Verification  
The process of the current phase involves the execution of consecutive steps, which are summarized in Figure 9. Details about these steps are provided below. _Step 1:_ In this step, we apply the reverse procedure of visual image encryption given in Section 4.4 to retrieve the original QR code image. In this step, it is necessary to use the correct KEY for decrypting the received zero-watermark. _Step 2_: Use a QR code reader to retrieve the information stored in the decrypted image. For this purpose, we used python's \"qrcode 7.3.1\" module. _Step 3_: Retrieve confidential patient information and the original binary feature vectors stored in the QR code. _Step 4_: In this step, use the _Ind_ vector to relocate the frames in the received bio-signal to extract their feature vectors. _Step 5_: Use (2) to compute the 2 DHMs of each frame of size \(N\times N\) to obtain four feature matrices denoted \(M_{i}^{*},i=1,\ldots,4\). Then, binarize these matrices by the same method given in step 3 (Section 4.2). Then, reshape the binary matrices into four feature vectors denoted \(VB_{i}^{*},i=1,\ldots,4\). _Step 6_: Encrypt \(VB_{i}^{*},i=1,\ldots,4\) by the same procedure mentioned in steps 5-7 (Section 4.2). By applying this step, the encrypted feature vectors \(E_{i}^{*},i=1,\ldots,4\) are produced. Then, use the bit error rate (BER) criterion to compare the encrypted feature vectors with \(E_{i},i=1,\ldots,4\). Next, the achieved BER values are stored in a \(BER_{V}=\{BER_{1},\ldots,BER_{4}\}\) vector where the BER criterion is computed by:  
\[BER=\frac{1}{L}\sum_{i=1}^{L}|E_{i}^{*}(i)-E_{i}(i)| \tag{23}\]  
_Step 7:_ Find the minimum BER value (\(Min_{BER}\)) of \(BER_{V}\) and compare this value with the threshold \(T_{BER}=0.05\). If \(Min_{BER}<T_{BER}\), the physician/doctor can proceed with analyzing the received bio-signal as it is considered original; otherwise, they inform the sender to retransmit the bio-signal while increasing the security level. To implement our scheme in real-world scenarios, it is necessary that it satisfies some fundamental requirements; namely (i) high degree of security, (ii) good robustness against various signal-processing attacks (noise, filtering, compression, common signal processing, etc. ), (iii) fast execution time, (iv) ease to implementation on hardware, (v) low power consumption, and (vi) portability. We assumed that our scheme satisfies requirement (i), since it involves the use of the proposed 2 DSCLM chaotic system that is very sensitive to its initial parameters. For requirement (ii), it was assumed to be satisfied, since our scheme involves the use of the 2 DHM descriptor that belongs to the family of discrete orthogonal moments, which is widely used in signal-processing applications for its good robustness against different types of attacks (noise, geometric attacks, compression, filtering, etc.). To investigate requirement (iii), we ran our scheme using four frames of electro-radiogram (ECG) signals, each frame with size L = 1600 samples. These frames were arbitrarily selected from a test signal called \"Record_100\" in the MIT-BIH arrhythmia database [41]. Figure 10 shows the test signal frames used in the current runtime test. Then, all the steps shown in Figure 5 were executed on a PC with the following characteristics: 4 GB of RAM and a CPU of 2.4 GHz. The programming language used to implement our scheme is Python 3.7. All the steps of our scheme were executed 100 times, the average execution time of each step was computed and is reported in Table 1, and the execution time percentage of each step in our scheme is shown in Figure 11.  
Figure 9: The proposed patient data recovery and bio-signal copyright verification. It appears from the results of Table 1 and Figure 11 that the feature vector extraction and encryption and the QR code encryption steps consumed almost 85% of the total execution time within the proposed scheme.