HDCP Key in Image Encryption Process
HDCP Key in Image Encryption Process
The linear regression model in the two-layer Caesar cipher is used to process the encryption and decryption layers by predicting values to modify the cipher text. During encryption, X values from model are chosen based on the sum of alternate row elements in image P, and Y values based on R. This results in predictions which, after a mod 26 operation, are used to adjust ASCII values of the cipher text. In decryption, the same model predicts transformations needed to retrieve original ASCII values, consistent with transforming alternate rows' sums in images P and R .
The dual-layer encryption approach first encrypts the image string using AES-256 with a SHA-256 hashed key to form a basic cipher text. Then, the two-layer Caesar cipher employs a linear regression model on the alternate row sums of images P and R to adjust ASCII values further, providing an additional layer of obfuscation. This combination benefits from AES's robustness in encrypting data and the linear regression-enabled Caesar cipher's complexity, enhancing difficulty for potential cryptanalysis, therefore increasing security .
The project combines AES encryption with visual cryptography by using AES-256 for encrypting the image string into cipher text with a hashed key. This key is then converted into an image, which is split into two images, P and R. C is another image initialized and filled by comparing the ASCII values of the key characters. P is generated from an XOR operation between R and C. This results in two images, P and R, that help in further encryption processes and illustrate visual cryptography through the secure distribution of key content across multiple layers .
After initial AES-256 encryption, the final cipher text undergoes transformation via a two-layer Caesar cipher. This involves adjusting ASCII values of the cipher text based on predictions from a linear regression model, which uses alternate row sums from P and R. Each cipher text character's ASCII value is moderatively altered by these predictions, bolstering security by adding complexity and effectively obfuscating the encoded content further from simple linear AES encryption, thus enhancing resistance against deciphering .
SHA-256 is used to hash the key (K) before it's used for AES encryption, ensuring that the key utilized in encryption is of a fixed length and adding a layer of security since hashed keys are difficult to reverse-engineer. This hashing converts the key into a form suitable for producing strong encryption while protecting the original key and making sure its complex structure is uniformly distributed .
The process involves converting the original encryption key into an image where each row corresponds to the ASCII code of a character in the key. This image is then split into two visual components, images P and R, using an XOR technique with random values in R. This splitting into P and R ensures that even if one image is exposed, the original key remains secure. This technique, part of visual cryptography, enhances security by distributing the key content across two secured images which individually convey no meaningful information about the original key .
Randomization in image R, achieved by assigning each pixel a random value between 0 and 1, is crucial to the encryption as it ensures that image P, formed by XORing R with the deterministic image C, is unpredictable. This randomness shields the encryption process from deterministic patterns that could be exploited by attackers to infer key information, thus preventing reverse-engineering of key components. Randomization enhances the uniqueness of each encryption instance, making attacks like brute force or differential cryptanalysis impractical .
Challenges include compatibility and coordination among libraries used (e.g., base64, hashlib, Crypto, numpy, cv2, sklearn) for various stages of encryption and decryption. Ensuring precise conversion between data formats and handling potential execution errors are crucial, especially when harmonizing processes like image manipulation and model training. The project mitigates these challenges by integrating these libraries in a Python Jupyter Notebook environment, which allows interactive execution and debugging, aiding in maintaining seamless integration of visual cryptography with AES and Caesar cipher models .
In the decryption process, visual cryptography facilitates the reconstruction of the original key by using images R and P to create a new image CK. This image CK, derived from XOR'ing P and R at each pixel position, is used to count the number of black pixels per row, corresponding to ASCII values, to regenerate the original encryption key used. Therefore, despite the destruction of the original key, enough visual cues remain in P and R for reconstitution in the decryption phase .
During decryption, once the key is reconstructed from images P and R and the two-layer Caesar cipher is reversed using the linear regression model to yield the initial AES cipher text, this initial text is decrypted using AES-256 with the hashed key. Subsequently, decoding the decrypted data back into utf-8 format allows the binary information to be saved as the original PNG image, completing the precise reverse-engineering of the initial encryption .