# HAE: A Hybrid Cryptographic Algorithm for Blockchain Medical Scenario Applications
## 3 Hybrid Cipher Algorithm Based on AES and ECC
In expansive healthcare systems with multiple entities requiring access to encrypted data, the secure dissemination of AES keys becomes intricate. On the other hand, ECC, an asymmetric cryptographic method, boasts superior security with shorter key lengths, making it especially valuable in resource-limited healthcare settings. The asymmetric design of ECC ensures data security; even if the public key is compromised, the data remain protected as long as the private key remains confidential. However, ECC's heightened security comes with a trade-off in time efficiency, rendering it less optimal for situations demanding rapid data access. Our proposed HAE algorithm endeavors to harness the strengths of both AES and ECC while mitigating their drawbacks. The encryption and decryption mechanics of this algorithm are delineated in Figures 3 and 4.  
AES Key Generation: A 128-bit random number is generated as the AES initial key. Subsequent key expansion, alignment, and other operations are performed to derive the AES full key. 2. Plaintext Encryption: Using the AES full key, the plaintext undergoes AES encryption to produce the ciphertext. Given AES's efficiency, the plaintext can encompass extensive data, such as medical records. 3. AES Key Encryption: The AES initial key is encrypted using the ECC public key, resulting in the encrypted AES key. Encrypting only the AES initial key is a strategic choice to heighten the challenge for potential attackers attempting to intercept the AES full key during transmission. 4. Encrypted Data Formation: The encrypted AES key and the ciphertext are amalgamated to produce the final encrypted data, which are then dispatched to the recipient. HAE decryption process(as shown in Figure 4):
1. Retrieving Encrypted Data: Upon receiving the encrypted data from the sender, the recipient extracts both the ciphertext and the encrypted AES key. 2. AES Key Decryption: The ECC private key decrypts the encrypted AES key, yielding the AES initial key. 3. Deriving the AES Full Key: The AES initial key undergoes processes like key expansion and alignment to derive the AES full key. 4. Ciphertext Decryption: The ciphertext is decrypted using the AES full key to retrieve the original plaintext. The hybrid algorithm, HAE, seamlessly integrates the rapid encryption capabilities of the AES algorithm with the heightened security and streamlined key distribution and management features of the ECC algorithm. While AES is renowned for its robust security, its key management can be intricate. A superior layer of key protection is achieved by leveraging ECC to encrypt the AES key. AES is distinguished for its exceptional time efficiency, making it indispensable for real-time data processing. Although ECC may exhibit slightly reduced time efficiency, the impact is minimal due to the mere 128-bit size of the AES initial key, ensuring overall high efficiency. The HAE algorithm safeguards keys throughout the encryption process, effectively addressing the challenge of AES key management without sacrificing performance. This offers a robust solution to the intertwined challenges of security and efficiency that are intrinsic to cryptographic algorithms. Particularly within the unique realm of blockchain healthcare applications, HAE ensures the confidentiality, integrity, and authenticity of medical data.