Comparison between RSA and CAST-128 with Adaptive Key for Video Frames Encryption with Highest Average Entropy

. Abstract: Encryption of data is translating data to another shape or symbol which enables people only with an access to the secret key or a password that can read it. The data which are encrypted are generally referred to as cipher text, while data which are unencrypted are known plain text. Entropy can be used as a measure which gives the number of bits that are needed for coding the data of an image. As the values of pixel within an image are dispensed through further gray-levels, the entropy increases. The aim of this research is to compare between CAST-128 with proposed adaptive key and RSA encryption methods for video frames to determine the more accurate method with highest entropy. The first method is achieved by applying the "CAST-128" and the second is achieved by applying the "RSA ". CAST-128 utilizes a pair of sub-keys for each round as a quantum of five bits that was utilized as a key of rotation for each round and a quantum of 32 (bits) was utilized as a key of masking into a round . The proposed adaptive 128-bits key can be extracted from the main diagonal of each frame before encryption. RSA is a public-key cryptographic technique which can be known as (asymmetric) cryptography. An asymmetry of a key depends on factoring a product of two big prime values. A comparison was applied on several videos and the results showed that CAST-128 method proved the highest degree of entropy even if the frames have lots of distorted data or unclear image pixels. For example, the entropy value of a sample of a girl video is 2581.921 when using CAST-128, while it is 2271.329 when using the RSA; also the entropy value of a sample of a scooter video is 2569.814 when using the CAST-128, while it is 2282.844 when using RSA.


Introduction:
The safety of data within a video becomes further substantial nowadays because of the quick development in the compression of multimedia video and the latest evolution within the technologies of the internet 1 . Those breakthroughs have enabled data of video to be employed like a medium out of which critical information can be transmitted and stored easily. Hence, the data of video need to be protected from unauthorized arrival through the way of storage and transmission. Encryption of video is the most secured and established ways for protection of video's content 2 . With the quick growth within the technology of multimedia, numerous armies via the world are employing videos for training recently recruited troops. Such critical data have to be preserved either within storage or transmission 3 . One potential road for protection the information within multimedia is to stop the arrival of unauthorized users. But this way cannot produce certain that the information of multimedia is secure physically. Another simple way is to encrypt the stream of bits completely via an algorithm of cryptographic like AES or DES 4 . However, videos possess generally a great amount of the data and demand real-time operations. In the situation of wireless-mobile systems, they are restricted within power of processing; bandwidth and memory are rarely capable for handling the dense encryption processing capacity 5 . Therefore, taking into sight the particular features for resourcelimited systems, novel algorithms for encryption the video must be developed. With real-world applications, an algorithm of encryption the video has to take into account diverse arguments like efficiency within computational, security, efficiency of compression and so on. Various kinds within applications of video demand various securities' levels 6 . For example, within the video deep security will be best while within purposes of military or financial information, high level of security is desired to prevent totally unauthorized arrival 7 . An efficiency of computational referees that the process of decryption or encryption should not take too much delays of time and meet the requirements of real-time implementations 8 . Compression of video is utilized to decrease the storage area and conserve bandwidth, therefore; the process of encryption should own the minimal impact on an efficiency of the compression. An algorithm of video encryption should supply adequate security and high efficiency of computational 9 .The first disadvantage of employing DES is that, the hardware enforcement of DES is extremely rapid; DES is not prepared for software and runs slowly. The second disadvantage is that DES utilizes one private key only for decryption and encryption because it is symmetric technique so if the key is lost within encryption of data then it cannot obtain the readable data at the receiving party. The main advantage of employing CAST-128 is that it is faster significantly compared with DES. The primary advantage of RSA method is increasing convenience and security. Private keys are never supposed to be revealed or transmitted to any party. But the secret keys of DES must be transmitted which may be a way for an enemy who can reveal these keys over their transportation. RSA can supply a technique for signatures digitally which is a major second advantage within RSA. The contributions of this paper are: 1. Using the RSA encryption method. 2. Using the CAST-128 method with the adaptive key. 3. The adaptive key used in the CAST-128 encryption method is extracted from the main diagonal of each frame. Each frame is with size 128x128 pixels. 4. Calculating the entropy values for each method. 5. The process of comparing the methods used on the basis of the highest entropy, where the method with higher entropy is considered the best method for encoding.

Related Works
Tremendous content of data transported via the network made encryption of video extremely an important topic, but when encryption of video works have been reviewed, it can be observed that works which focus on this topic are few. The next works introduce the most significant algorithms for encrypting the video: 1. Ibrahem et al 10 , suggested a method for encryption of video via employing a chaotic system to generate the key and stream-cipher .They employed chaotic chart as one time generator of the key which produced the key of encryption. Two methods were suggested for key generation. The first method utilized catmap as a created key while the second method introduced larger space of key because it employed three values initially, two for catmap and one for logistic-map that increased the number of premier values and equations' number leading to rise the time for generation of key. Empirical outcomes displayed that both suggested methods are secure and they can reconstruct video with perfect (MSE) equal to zero and extreme amount for PSNR. 2. Kunte et al 11 proposed a work for emphasizing an encrypting simply the frame's chunk which was of greater awareness of (Video on Demand) VoD. Selecting novel encryption of video depended on entropy and was calculated via utilizing special parameters like PSNR, coefficient of correlation, Histogram and NPCR. The outcomes provided most the optimum amounts and employed for exercises of the method in (VoD). 3. Cheng, et al 12 , proposed an encryption procedure for (H.264/AVC).This procedure encodes a video to numerous pieces through the employ of (Cipher Feedback) (CFB) style of AES with a dynamic key. The key was updated too in real-time and was produced via (PRNG). The framework of encryption goes via three levels. A novel (4-D) hyper chaotic procedure was produced to protect the privacy of data. Empirical outcomes displayed that the proposed methodology for encryption of video owned less time and better effect for encryption. 4. Nahresdt et al 13 , produced a novel algorithm known Video-Encryption-Algorithm (VEA). It depends on the statistical characteristics of (MPEG) video norm and an algorithm of symmetric-key which decreases the encrypted data amount. An algorithm of VEA splits the input stream of a video into two chunks and those chunks are extra split to segments of data to list of odd and list of list. After that, a key of encryption is utilized to the list of even. The encoded resultant list is merged XORed with the list of odd and the concatenated outcome is the ultimate cipher-text. As an outcome, VEA is protected from known plain text attack due to every frame will have a various key. 5. Wang et al 14 . suggested a technique which is considered the connection amidst the descendant and current frames. The encrypted current-frames further dependent on descendant -frames. They simply encrypted the current-frames, while the dependent-frames are not encrypted. The main advantage of this technique is reducing the rate of bit within a video to a great scope.

Proposed Methodology
The proposed methodology for video frames encryption and decryption is made up of three steps. In the first step, the video frames series are taken from video stream. The keys for the methods of encryption have been prepared and then CAST-128 encryption method is applied on each frame, then the encrypted frames have been stored. After that, RSA encryption method is applied on each frame, and the encrypted frames are stored in the second step. For the third step, entropy is computed for each frame to find the best encryption method based on highest average entropy. A flowchart for the proposed methodology is shown in Fig. 1:

CAST-128 with Adaptive Proposed Key Encryption Method
A suggested methodology for encryption of a video frames has two steps. The values of the main diagonal of an image can be extracted as a key in the first step. Secondly the steps of CAST-128 can be calculated.

 CAST-128 Key Generation
The key of CAST-128 can be extracted from the main diagonal of each frame. The size of each frame is 128x128.The key is calculated from the following formula:   (3,6,9,12,15) (

RSA Encryption Method
A cryptographic algorithm of RSA is a public-key and also called asymmetriccryptography. The asymmetry of a key relies on factoring the product of two big prime numbers 19 . Messages that were encrypted within a public-key could be decrypted also in a feasible time's amount via employing a private key. Exponent and Modulus operations are performed to produce the private and public keys 20 . The cryptosystem's security with RSA is associated with factoring great numbers and finding "e th " root modulus of a composite "n", then computing an amount "m" via "C=m^e (mod n)" in which "n ,e" represent the public key and "C" represents a cipher text. If an attacker calculates a secret exponent "d "from the public key "n, e " then "C" is decrypted via employing a standard process. But surely it is time -wasting to detect an integer factorization within a polynomial time, and this still proves (RSA) to be a robust algorithm 21 . Employing small and approximately close primes: if the primes are small to an adequate degree, then a factorization of (n) will be a simple duty. if (p) and (q) are comparatively close, then detecting the common factors determines the public-key. It needs longer time for encryption and usage of a memory which finally slows down the algorithm's speed 22 . The parameters of RSA can be illustrated as: 1. Choose q and p which are primes, where q ≠ p 2. Compute the value of n via n = q*p 3. Compute (Φ(n) = (p-1)*(q-1)) 4. Choose the variable (e) as integer type where (GCD (Φ(n), e) = 1) and (1 <e < Φ(n)). 5. Compute the value of d via (d ≡ e -1 (mod Φ(n)) ) 6. The public-keys (n, e) and the Private-Keys (d, n).

Entropy
Randomness is a substantial characteristic in the processes of cryptography because the information must not be capable to be predicted by an attacker. Entropy is a measure of information randomness 23 . It measures the information's uncertainty. Within the information's security, it requires algorithms of security to produce an encrypted message with a high degree of randomness so that there is no dependence between cipher-text and key, or it becomes less. With a high degree of randomness, the relevance among ciphertext and key turns out to be complicated. This characteristic can also be named confusion. A high grade of confusion is preferred so as to make it more complex to be predicted by an attacker. Entropy can be employed to reflect the cryptographic algorithms' performance 24 . We can calculate entropy using Eq.1 25  8717 "L" represents an overall number with gray levels ready. For a model "8-bits", there are 256 numbers that range from "0 to 255". "p (g)= (N(g)/X*Y)" "N (g)" represents the numbers of pixels at gray level "p". P (g) represents a probability.

Empirical Results
The empirical results of the proposed methods are discussed and displayed in this section. The proposed methods were implemented using C# programming language. The main libraries used with the implementation of this work are Accord.Net and AForge to load a video, extracts frames and then apply encryption methods. Five kinds of databases are utilized to evaluate the proposed methods. The proposed methods consist from three steps as illustrated bellow:-1. At the first step, the video stream is loaded and the frames are extracted as shown in Fig.4 for girl video, Fig. 5 for scooter video and Fig. 6 for car video. The values of the variable p and the variable q are set to the length of a frame for RSA encryption method. While the key of CAST-128 is adaptive and extracts this key from the main diagonal of a frame. In the second step, the adaptive encryption key is extracted from the main diagonal of each frame that is used with the CAST method. CAST-128 and RSA encryption methods are applied to the video frames as shown in Fig. 7 for girl frames, Fig. 8 for scooter frames and Fig. 9 for car frames. 3. In the third step, the entropy value is calculated for each frame which is encrypted by both CAST-128 with adaptive key and RSA. Entropy is a measure of disorder or randomness, and hence a measure of uncertainty. Thus, entropy can be considered as an assessment criterion for the significance of ciphering technique. The higher the entropy, the better the encryption algorithm. Entropy values for a sample frame of tested videos can be illustrated in Table 2.  Table 2 shows that CAST-128 with adaptive key scores highest average entropy with encryption .An entropy is a scale stage of randomness for information. Randomness is an important and highly demanded characteristic of cryptographic algorithms.

Limitations
There are different limitations of using RSA and CAST-128 as illustrated bellow:-1. The main limitation of using RSA is that the security of (RSA) deepens on the functional difficulty of product's factoring of two great prime numbers. 2. The main limitation of using CAST-128 is that via of a renowned plain text attack, CAST 128 Key may be known via cryptanalysis linearly. It can be cracked via (2^17) selection plain-texts over one related key query within offline action of (2^48).

Conclusion:
The aim of this research is to compare between CAST-128 encryption method and RSA encryption method for video frames to find the best encryption method based on entropy value and determine the more accurate encryption method for highest entropy. The first method applied the "CAST-128 encryption method" and the second method applied the "RSA encryption method". CAST-128 utilizes a pair of sub-keys for each round as a quantum of five bits was utilized as a key of rotation to each round and a quantum of 32 (bits) was utilized as a key of masking into a round. RSA is a public-key cryptographic technique which can be known as (asymmetric) cryptography. An asymmetry of a key depends on factoring a product of two big prime values. For example, the entropy value of a sample of a girl video is 2581.921 when using CAST-128 encryption method, while it is 2271.329 when using the RSA encryption method; also the entropy value of a sample of scooter video is 2569.814 when using the CAST-128 encryption method, while it is 2282.844 when using RSA encryption method.