## 2 Materials and Methods
### Cardio Data Protection Procedure
#### 2.2.3 Digital Watermarking  
The incorporation of a watermark in cardiac signals and data, as well as in the header of the compact record in which personal information about a particular patient is transmitted, is used to protect the continuity of personal data and the medical research of individuals. Cardio signals must be stored and transmitted with sufficient accuracy to ensure that their most important property, namely their ability to carry diagnostic information, is preserved. To this end, it is important to preserve them without changing the form of the basic waveforms of the cardio signals, which must not be influenced by the embedded watermark. Digital encryption of watermarks by quantizing cardiac data was used in this work. Embedding  
In this work, the watermark is embedded in cardiac data after a Db4 wavelet transform with four levels of decomposition. The watermark (sequence Mr) was embedded in the lowest frequency, to ensure its resilience to attacks. The sequence Mr with cardio data information \(\{cd_{i}\}\) is added to coefficient \(c_{i}\) whereby the transformed coefficient \(c^{\prime}_{i}\) is obtained at the lowest fourth decomposition level by the formula [28]:  
\[c^{\prime}_{i}=\left\{ \begin{array}{l}\begin{array}{l}\frac{c_{i}}{\mathrm{ Mr}}\left|\cdot Mr+\frac{3}{4}Mr,\text{ {if }}c_{i}=1;\\ \frac{c_{i}}{Mr}\right|\cdot Mr+\frac{1}{4}Mr,\text{ {if }}c_{i}=0.\end{array} \right.\end{array} \right. \tag{5}\]  
Extraction  
Extraction is implemented through this rule, where \(c^{*}_{i}\) is the WT coefficient of the lowest-frequency sub-band and \(cd^{*}_{i}\) is the embedded watermark sequence [28]:  
\[cd^{\prime}_{i}=\left\{ \begin{array}{l}1,\text{ {if }}c^{*}_{i}-\left|\frac{c^{*}_{i}}{ \mathrm{MT}}\right|\cdot Mr\geq\frac{1}{2}Mr;\\ 0,\text{ {if }}c^{*}_{i}-\left|\frac{c^{*}_{i}}{\mathrm{MT}}\right|\cdot Mr< \frac{1}{2}Mr.\end{array} \right. \tag{6}\]  
This presented embedding/extraction method is stable and resistant to compression, filtration, and geometric transformations. Encryption  
In this work for the encryption of cardio records (ECG, Holter, PPG), the cryptographic hybrid algorithm is applied and analyzed. The presented hybrid crypto algorithm used two keys: a public key and a private key. The algorithm uses the RSA algorithm to encrypt the public key, with most of the work on encrypting/decrypting cardio records performed through a more efficient AES algorithm using a symmetric key. RSA was one of the first public-key cryptosystems, being first published in 1977. Created as a revolutionary technology for encryption and decryption, RSA is able to provide sufficient security for data and today's information systems. RSA technology is based on an encryption procedure using a public key; authentication of the sender with a digital signature. The technology is difficult to break because it is based on decomposing numbers that have a very high total number of digits (for example, 200 or more) into prime factors. The technology provides a method for generating through simple calculations of two prime numbers and also generates through calculations and two keys needed for the process of transmitting information. Bit multiplication and modular multiplication are the simple arithmetic operations on which the algorithm is based. The data is initially divided into segments in order to implement the process of their encryption.