# HAE: A Hybrid Cryptographic Algorithm for Blockchain Medical Scenario Applications
## 4 Experiments and Analysis
### Experimental Procedures  
Figure 5 presents the framework for the application of the hybrid cryptographic algorithm, HAE, within a blockchain healthcare context. This framework encompasses the blockchain, hospital entities, the InterPlanetary File System (IPFS), medical data, and the processes of encryption, decryption, data uploading, and retrieval. The detailed experimental procedure is as follows. When a patient visits Hospital 1, the institution generates the patient's medical data. These data are encrypted using the hybrid cryptographic algorithm HAE (as detailed in Figure 3) and subsequently uploaded to the InterPlanetary File System (IPFS) [33]. IPFS, a novel peer-to-peer file system, has gained significant traction in  
blockchain and other distributed systems in recent years. Unlike traditional file systems that rely on directory-based addressing, IPFS uses content-based addressing. This unique approach facilitates segmenting large files into smaller chunks, enhancing throughput and storage efficiency. Once a file is archived in IPFS, the system provides a hash value as an address tag, enabling users to locate the file using this tag swiftly. Upon receiving the address hash from IPFS, Hospital 1 integrates with the blockchain as a node and uploads this hash. If a patient subsequently visits Hospital n and requires access to the medical data from Hospital 1, they simply grant authorization of their personal details to Hospital n. With this authorization, Hospital n retrieves the address hash via blockchain sharing, extracts the encrypted medical data from IPFS, and decrypts it using the HAE algorithm (as depicted in Figure 4) to access the original medical data. All medical data are encrypted using HAE and stored within IPFS. To access these data, hospitals must obtain patient authorization before decryption, including relevant personal information and the ECC private key. Importantly, hospital nodes on the blockchain store only have access to the address hash corresponding to the medical data, not the data themselves. This approach underscores the blockchain's decentralization principle and is pivotal for safeguarding medical data and patient privacy.  
The hybrid cryptographic algorithm HAE involves the following algorithmic steps:  
1. AES Key Generation: The 'genKeyAES0' method is employed to generate the initial AES secret key. The 'loadKeyAES0' method is then used to convert the initial AES secret key into a 'SecretKey' object.
2. ECC Key Generation: The 'getKeyPair()' method is utilized to generate an ECC secret key pair. The public and private keys are subsequently converted into 'PublicKey' and 'PrivateKey' objects, respectively.
3. Encryption: The sender reads the medical file content using the 'Files.readAllBytes()' method. The actual content is encrypted with the 'encryptAES()' method using the full AES secret key. The AES initial secret key is then encrypted with the 'publicEncrypt()' method using the ECC public key.
4. Decryption: The receiver decrypts the file using the 'privateDecrypt0' method with the ECC private key to obtain the initial AES secret key. The file is then decrypted using the 'decryptAES0' method with the full AES secret key to retrieve the actual content of the file.