Bulletin of Electrical Engineering and Informatics

Shihab A. Shawkat, Najiba Tagougui, Monji Kherallah National School of Electronics and Telecommunications of Sfax, University of Sfax, Sfax, Tunisia Department of Computer Science Engineering, Higher Institute of Computer Science and Multimedia, University of Sfax, Sfax, Tunisia Department of Physics, Faculty of Science, University of Sfax, Sfax, Tunisia Department of Quality Assurance and Academic Performance, University of Samarra, Samarra, Iraq


INTRODUCTION
In the modern usage, rapid data interchange has largely defined how the internet has developed, and the extensive and thorough use of devices by users has enabled them to communicate with one another and share information. As a result, it is concluded that it is important to protect the devices and the exchange of information between them [1]. Multimedia streams are currently simple to obtain thanks to the ubiquitous usage of the wireless networks and internet, the exploding expansion of consumer devices, and improvements in multimedia compression methods. In an effort to safeguard the aforementioned multimedia materials and grantee that any additional data is effectively hidden inside such digital files [2]. Genetic algorithm (GA) can consider one of the modern methods, as the importance of using it in solving complex problems has emerged, in addition to solving difficult problems in research operations, as well as solving coding issues and cracking the code [3]. General of how to produce new individuals that possess certain characteristics (desirable or undesirable) through modification, overlap or alteration that obtains the inherited groups with the aim of forming new individuals. GA has been used in the present research to generate the stream cipher key, after reviewing some previous research that dealt with the uses of GA with encryption and decryption [4].
Video, text, audio, and images are the most common types of media. Despite the existence of numerous steganography methods, they are vulnerable to statistical, structural, and visual attacks. Texts with hidden data are anticipated to have greater entropy compared to those without in terms of text steganography [5]. Systems like stream ciphers are categorized as secret key systems since they only use one secret key for both decryption and encryption. These systems are the most popular and frequently utilized in encryption due to a number of crucial features, such as: (no errors in the event of occurrence, simplicity of usage in real applications, implementation speed. As a safe method of keeping information, stream cipher is one of the most significant relatively modern encryption techniques used in communication and storage systems [6]. No encryption technique is impenetrable by those who are determined to get inside. Using keys only once with stream cipher is the best approach to guarantee security. Each key must also be independent of the others used. In this manner, the rest of the system's security will be unaffected even in the case where attackers successfully crack one of the keys [7]. With the aid of a few algorithms depending on mutation, crossover, and selection, among other things, we will describe the fundamentals of GA, decryption, and encryption in this part. Under this idea, a vast method associated with generating secret keys for cryptography and random numbers is used. -Generic algorithm One of the general search algorithms depending on the mechanism of natural selection and the natural genetic system is the GA, a heuristic search algorithm that draws inspiration from Charles Darwin's theory of natural selection. It is intended for the inherited groups (adding or replacing certain genetic materials) in order to form individuals with good traits, and on this basis the GA selects the preferred solutions from a large number of solutions and makes some overlaps and alterations between these solutions in order to create better solutions [8]. The GA is a method of artificial intelligence and it is one of the modern methods, as the importance of using this method has emerged in solving complex problems (large in size and has a huge number of alternative solutions) in an appropriate time. The solution resulting from the application of the GA is often a near optimal solution, and this method, when applied, provides an intelligent search among a large number of alternative plans [9].
The method of GA in solving various problems depends on ideas deduced from genetics, which is generally concerned with how to produce new individuals that have certain characteristics (desirable or undesirable) through modification, interference or switching that obtains the inherited groups in order to form new individuals [10]. GA are optimization techniques that use an evolutionary process. The solution to the problem is a data structure known as chromosomes. The quality of the solution is evaluated with a function called the fitness function, and a series of initial solutions (a random community) is generated through a combination of processes similar to an evolutionary process. A certain value is chosen for the stop. Before proceeding to apply the GA, there is a necessity in encoding data-set in any of the formats, like bit encoding. We consider a group of the solutions for a problem and choose the set of optimal ones amongst them. Five phases have been considered in the GA [11]: a. Do initial population: a population, a set of individuals, is where the process starts. Every individual is a component of the solution to the problem you're trying to address. The genes can be described as a set of parameters or variables defining an individual. A chromosome (solution) consists of a string of genes. A string, or an alphabet, is used in a GA to represent an individual's set of genes. Binary values are typically utilized (string of 0 s and 1 s). We refer to genes on a chromosome as being encoded. b. Fitness function: which gauges an individual's fitness level (an individual's ability of competing with other individuals). Each individual receives a fitness score. Depending on its fitness score, an individual's probability of being selected for the reproduction has been determined. c. Selection: the purpose of the phase of the selection is to choose the most fit individuals and allow them to pass on genes to the following generation. Depending upon their scores of fitness, two sets of individuals (also referred to as the parents) have been selected. High fitness individuals are more likely to be selected for the reproduction. d. Crossover: the crucial stage of a GA is crossover. A random point of crossover from among genes is selected for every pair of parents before mating. e. Mutation: a few of newly produced offspring's genes have susceptibility to random mutation of lowprobability. This suggests that a few bits in the bit string could be reversed. This step overcomes the issue in the case where the value of the fitness at some point is stuck at local minima. None-the-less, it's stopped typically when certain condition of termination has been met. Some of the common conditions of termination are [12]; i) a predetermined number of the generations had passed, ii) a satisfactory solution was found, and iii) no improvements in the quality of the solution have happened for a specific number of the generations converging to a solution. The evolutionary cycle may be summarized as; i) generation=0, ii) seed population, iii) while not (termination condition) do, iv) generation ++ , and v) compute the value of the fitness.
-Stream cipher One byte or bit of the plain-text is encrypted at a time by a stream cipher, a type of encryption algorithm. The key represents an infinite stream of the pseudo-random bits. An implementation of the stream cipher must have an unpredictable pseudo-random number generator and never use one key twice to remain secured. Stream ciphers aim to come close to an idealized cipher, which is meant to use a completely random key, might be able to attain "perfect secrecy". It is intended to be completely resistant to brute force attacks [13]. The pseudorandom bit generator will receive a key (k) as input, and it will after that produce a random 8-bit output that is referred to as key-stream. The final keystream will be 1 byte in size, or 8 bits. Following a stream of pseudo-random numbers is how the stream cipher operates. In the stream cipher, every one of the digits of plain-text is encrypted individually with corresponding key-stream digit for producing a cipher-text stream digit. It is sometimes referred to as a state cipher since the encryption of every one of the digits depends upon the current state of the cipher. In reality, a digit is often a bit, and an XOR is used to combine them [14]. Bits are processed in a chain, one by one. High speed and simplicity of the hardware. A key and a lengthy initialization vector with no repetition are frequently coupled. If properly designed, it is equally secure. Usually really quick and simple. There are many advantages of using stream cipher, including [15]: a. Speed: this encryption form is usually faster than others, which include the block ciphers. b. Low complexity: it is easy to incorporate the stream ciphers into the modern programs, and the developers do not need complex hardware in order to make it happen. c. Ease of use: stream ciphers are tools of symmetric encryption; therefore, the companies are not forced to bother with the private and public keys. The mathematical concepts which underlie the modern stream ciphers allow the computers to decide the correct decryption key to be used. Various organizations and people utilize stream ciphers because they are simple to implement. The majority of websites and web browsers use this technique. Making cryptanalysis more challenging is one of the advantages of using stream cipher, hence the number of the bits that have been selected for the keystream should be large so as to achieve this. It is also secure from brute force attacks because to the longer key. Stronger security is achieved, preventing any attack, the longer the key. To make cryptanalysis more challenging, keystream could be designed more effectively by having additional 1 s and 0 s. One of the significant advantages of the stream cipher is that it uses less code compared to a block cipher [16]. stream cipher divide the plaintext P into binary orders, P1, P2, P3, or sequential symbols, and encrypt each Ei using the Ki of the key sequence k1, k2, k3, as (1).
The encryption process is as in (2).
where Ci, Pi, Ki represent the binary orders of a key, the original and the cipher respectively and ⊕ represents the XOR. The properties of the resulting randomness were relied upon by applying the conditions of approved randomness. Plaintext and key-stream produce the cipher text (an identical key-stream will be utilized for the decryption). Plain-text will undergo the XOR operation with the key-stream bit-by-bit and produce cipher text. Figure 1 for instance, if the next byte generated by the generator is plaintext: (1001 1001), key-stream: (1100 0011), cipher text: (0101 1010). The cipher text and key-stream give the original plaintext (by using the same keystream for the encryption). Cipher-text will undergo the XOR operation with the key-stream in a bit-by-bit manner and produce the original plaintext. Example: cipher text: (0101 1010), key stream: (1100 0011), plaintext: (1001 1001) [17].
-Hashing It is a mathematical function whose input is a series of variable length data that represents the message data itself and may be applied to the key as well. The camouflaging function converts the variable length (random) of the entered data into a series of fixed length data whose length is usually less than the length of the data. The data entered. The output of a good hash function must be equally distributed, and it should also have pseudo-randomness, one-way characteristic, and collision resistance. Finding a message which maps to some specific message digest (one-way property) or two messages mapping to same message digest must be computationally efficient yet computationally impossible (collision-free property). Hash functions are employed to make sure that a message's integrity is preserved because of these characteristics [18]. Through it, we can distinguish the original message and accurately identify it, so that any changes in the message key, even if it is in one bit, will result in an entirely different fingerprint, it is not possible to derive two equal functions for two different messages, and it is also used to ensure that the message came from its source without being exposed to any change during transportation. The simple hash function has been used. This function performs the XOR operation according as (3) [19]: where Hi (binary coding sequence in camouflage), M (number of binary coding in the second input), Bi (binary coding sequence in specified), the original and the cipher respectively and ⊕ represents the XOR.  Figure 2 represents the basic operation of hash function. Generally, integer contains message multiple of some fixed length which is padded onto it and padding contains the value of original message length that is in bits. Length field provides security measure which increases the trouble for an external attacker aiming to produce another message using same hash value [20]. Several of the most important works on multimedia and data privacy that make use of steganography and many associated technologies. The significance of healthcare services has recently come to light on a global scale, and it has become one of the most important research areas in academia and business. Yet, to guarantee seamless and error-free procedures, the best data privacy must be preserved. The secrecy of electronic data sent over the internet is covered in [21]. The use of GAs with pseudorandom sequences for encrypting and decrypting data streams as a novel strategy for e-security applications. The method by which the strings can combine and contrast their appealing traits at random. We choose two new random strings as strings to the right of randomly chosen point in the two strings are then exchanged. This process starts by selecting a random location in both strings. In this manner, information is exchanged between the strings, and pieces of two strings are joined and exchanged. To enhance both the security and the quality of the steg image, a more secure technique is put forth in [22]. GA can be defined as a semi-blind algorithm; therefore, it might choose a key that compromises security. Using the GA and optimal pixel adjustment process (OPAP), a more secure image hiding method. As a result, the security is implemented by applying image transformation utilizing both a user key and the GA key. The hidden image's pixel locations are rearranged using the user key. The GA after that uses OPAP to choose the key that maximizes the stage-quality images and security. The approach employs an easy-to-use transformation technique that sharpens the contrast between the secret image and its altered counterpart. Data encryption is frequently used in [23] to assure data security. A group of optimization methods are known as GAs. Encrypting and decrypting data streams by means of GAs with pseudorandom functions. To enable the algorithm to be used with any type of .txt, the encryption process is applied to a binary file. We essentially utilized 5 keys in the algorithm, and we are now using blum shub pseudorandom number generator (PRNG). According to Alhussain [24], it is demonstrated how to create a key exchange algorithm based on the GA's mutation and crossover operations and asymmetric key encryption. By permuting the key by a random permutation factor, the number of crossover points and mutation points determine the length of secret key. The combination of randomization and permutation makes the algorithm resilient and difficult to break. The text encryption algorithm based on the block cipher and chaotic maps has been suggested in [25] and decrypted for blocks of (88) bytes. The previously constructed nonlinear substitution S-box component. To create the key sequences utilized in decryption and encryption, a random key generator depending on tent map is employed, which depends on a 2D logistic map and a 2D cross-chaotic map. Pseudorandom numbers were generated using the multiplicative congruential generator approach in [26]. The aforementioned suggested algorithm has been tested on a variety of text files containing data like numeric values, plain text, and special characters. Have utilized a GA-based cryptography algorithm for data decryption and encryption.
According to Agbedemnab et al. [27], a new text encryption and decryption approach that has been referred to as the GA residue numbers (GARN) is proposed. This three-layered text scheme has a high throughput rate and can encrypt both smaller and larger messages. It can encrypt and decrypt any character or symbol with the use of GA and some inherent properties from residue number system (RNS).
The mutation and crossover operators of a GA are used for generating a new session key in [28], which developed a cryptographic algorithm depending on session key for each image encryption. Uses 64-bit plain text and needs an 80-bit key, with the remaining 16 bits of the key being added randomly. The 64-bit key is created using a symmetric hexadecimal key. To protect diagnosis data in medical images, [29] introduces a new data encryption model hybridization. The suggested model has been created through combining the suggested hybrid encryption technique with either 2D discrete wavelet transform 1 level (2D-DWT-1 L) or 2D discrete wavelet transform 2 level (2D-DWT-2 L) steganography. The advanced encryption standard (AES) and Rivest-Shamir-Adleman (RSA) algorithms are strategically combined to create a hybrid encryption scheme, which secures the diagnosis data that will be incorporated with RGB channels of a medical cover image. The application of an adaptive GA for optimal pixel adjustment process (AGA-OPAP) that enhances features for imperceptibility and data hiding.

STREAM CIPHER RANDOMIZATION USING GENETIC ALGORITHM
In order to obtain more confidential encryption, faster implementation, and cost capturing, a hybrid algorithm has been proposed to take advantage of the genetic properties to generate a key and verify its randomness using approved methods. Instead of regenerating the key at the receiving party, a new method was used to hide the key inside the ciphertext before sending it, and the integrity of the key you used was confirmed using camouflage. In the work structure of the proposed method, the GA was relied on to avoid the disadvantages caused by the traditional methods. Initially, a random generation of the key was generated using the rand function, noting that the key length must be the length of the text to be encrypted, then the randomness is measured for each member of the generation according to the approved conditions.

Encryption phase
In the encryption, the algorithm hides the key inside the cipher text after the generation of the key, the encryption starts by XOring the resulted key with the text to be hired as can be listed in the following steps: − Message encoding For generating the key, we need first to check the length of the message that need to be encrypted. For the word "abc" the American standard code for information interchange (ASCII) code for the "a" is 097, "b" is 098 and for "c" is 099. Its noteworthy to mention that the message encoding considered is the binary code of each ASCII number corresponding to the letters in the message. Thus, the "abc" message is first transformed into "097 098 099" and then it is transformed to "01000001 01000010 01000011". The length of the message now is 3×8 which is 24-bit length that represents the key-length at same time. The key will be randomly generated whose values are uniformly distributed between 0 and 1. Table 1, shows the ASCII code and its binary representation of the input message. − Generate a random key: the same length of the input message. − Check the generated key quality If the quality of the generation key according as (4) was good enough i.e., the get obtains the maximum value of (4), that would suggest the key wouldn't need to go through the key-optimization-process. It will be used right away in the encryption process. However, if the key failed to satisfy the equations mentioned above, then it needs to undergo the key-optimization-process. In the optimization process, the GA would be used to optimize (4). In order to find the value of (4) assume the count of 0 s is represented by x while the count of 1 s is represented by y. Also, we have n that represents a threshold value. Then, in order to find the objective function of the input key, we have to calculate f1, f2, and f3 and add them together as shown in (4). Thus, we first calculates the number of 1 s and 0 s in the key and returns the value of f1 either zero in the case of unequal or one in the case of equality while the second function starts when we enter the value of n that represents the number of block units required and n=8 and search for these n within the key string and returns values either zero in the absence of a block of size n or one in the case of a block of size n and also returns either zero in the absence of the presence of a gap of measure n-1 or one in the case of a gap of measure n-1.
1, ≥ 0, < − Key optimization process In this step, the evolutionary optimization is applied in order to generate a stronger key than the one resulted in the last step. The same criteria used in the last step, used here in the evolutionary process as an objective function i.e., in (4). However, this time it is used iteratively. The process starts from generating four new random solution. Thus, we can say that the population equals 4 solutions. Each single solution of these four candidate solutions is evaluated simultaneously using (4) until we find the optimum or the near optimum solution after several generations. The optimization continues until a satisfactory value of the fitness function is obtained for anyone one of the candidate solutions. It is expected that during the consecutive generations, the solutions highly ranked will be used for the message encryption. − The initial population is first evaluated using the fitness function This fitness function represents a maximization function that means that solutions having the highest fitness value is passed to the next generation. The best couple of solutions in the population is selected for the crossover and the mutation. Again, the fitness function is applied on the resulted new solutions. At this point the solution that achieves higher fitness than its own parent or any other individual in the population, then parents are substituted by their children. Now the previous step's output will work as an input of the operation of mutation. After mutation we will get the final key that would be utilized in the process of the encryption. Figure 3 shows the process of the key generation using GA to be utilized in encryption. Key length must first be determined so as to decide the GA working parameters before starting optimization process. The proposed parameters for the GA process as follow; i) generations=determined by reaching to the best solution according to the fitness function, ii) initial population=4, iii) selection=roulette-wheel, iv) crossover=one-cut point crossover, and v) mutation=uniform with 0.001 probability. Encryption: the text to be encrypted is XORed with the random key generated either from step 4 or 3. − After the completion of the XOR operation, the hash function is calculated for the key. − After encryption After the encryption a frame will be generated that has the following elements; i) the generated key and the encrypted message with zero padding among its bits, ii) the hash no. That is generated from the secure hash algorithm 1 (SHA-1) that takes an input then produces a 160-bit (20-byte) hash value that is referred to as message digest-usually rendered as 40 hexadecimal digits, iii) zero-bit added after the hash, 1013 iv) key location generated from the random permutation with two zeros padding among its bits, and v) finally, the size of the message character is appended as a last part of the frame. All the steps explained earlier, are summarized in Figure 4.

Decryption phase
The decryption here is the process of extracting the original message from the frame illustrated in Figure 5. The decryption starts first from splitting the frame of 1-D array of elements and retrieve the last element that represents the length of the message. Afterwards, the key location is extracted with removing the appended two zeros. Then all other zeros added to the secret message are all removed. At this point the message location must be found by extracting only key by its location, extracting the secret message by its location and finally extracting the hash number from the frame. It is very important to convert the binary array of key the message into decimal numbers.

RESULTS AND DISCUSSION
The simulation was done using MATLAB® R2021b and a CORETM i5 microprocessor laptop. The simulated results are shown in Table 2 with their average times of execution. The proposed scheme was tested on different types of text files containing (letters, numbers and symbol) characters. The proposed algorithm has the ability to encrypt and decrypt any character and size from ASCII table. Its relating ciphertext utilizing the proposed algorithm and the key.

Suggested method graphic user interface
The developing a simulation environment is very vital in order to verify the proposed algorithms and its performance. Experiments confirm that the developed approach allows us to receive a more readable and easier-to-interpret structure in the form to obtain much lower learning and testing errors compared to other techniques. The proposed systems integrate three modules (normal method, GA, my proposed) that together constitute the experimental application is encrypting and embedded, then decoding and extraction text using encryption techniques. This frame is represented in Figure 6.

Experimental results
The proposed algorithm has the ability to encrypt and decrypt any character and size from ASCII table. Its relating ciphertext utilizing the proposed algorithm and the key. We note in Table 2  1015 encryption and decoding time of texts are good and are not subject to any rule because they depend in text encryption on the process of creating the key using the GA. We also note that the decoding time is less than the encoding time because in the decoding process the GA is not used. In Table 2 the results of the statistical parameters that have been obtained after the use of various textual data files that possess letter, special characters of different sizes. This table has the text size measured in bytes and stored as a txt file. It also has the encryption, decryption execution time measured in seconds. Besides, it contains the encryption round number and finally the key size measured in bits. The number of symbols considered is randomly chosen between 1 and 15 symbols. They represent different text file sizes ranges between 10 bytes to 1,000 byte.  As can be realized in Table 2 that there is a direct correlation between the text file size with the encryption execution time. For instance, if the file size equals to 10 bytes only, the encryption execution time would equal to 0.0053265. Similarly, when the file equals to 1,000, once can notice that the encryption execution time has increased according to the file size. When it comes to the decryption execution time, another scenario can be observed. It is noticed that there is no direct relationship between the file size and the decryption execution time. For example, in the first test when the file size equals to 10, the decryption time equaled to 0.0001729, as for the next text when the file size was increased to 20 there was a similar decryption time to the file when it was only 10 bytes which was almost equal to 0.0001. Until we reach to the file size that equals to 70, the decryption time still almost the same. It has increased slightly when the file size equaled to 70, until it reached its highest decryption time when the file size equaled to 1,000 byte. In all cases when the decryption time is compared to the encryption time, it can be clearly perceived that the encryption time is much higher in all cases. Figure 7 shows the relationship between file size on both encryption and decryption execution time.
The execution speed of the encryption and decoding algorithm was measured to ensure its speed and the results were as shown in the Table 2. A decent cryptosystem must be sensitive at secret keys this implies ciphertext created utilizing somewhat diverse keys ought to be altogether different. The ciphertext with inaccurate key does not demonstrate any data related with plaintext, hence the proposed algorithm is sensitive to secret key.
Thus, in Figure 7, once can notice in both Figures 7(a) and (b) there is an increase in the time required for the encryption due to the need to calculate the key using the proposed method. However, the extra time need at the encryption is insignificant. When it comes to the decryption, the time required for the decryption is less than that needed for the encryption because there is no need to calculate the key again. In Table 2, we note that the generated key goes through the number of rounds in our proposed method. Every time the number of rounds varies according to the text size and the number of rounds, because the process of generating or creating the key is done using the GA and the randomness of the key generated in each implementation is completely different from the one before it completely. This is what it distinguishes the proposed method. As well as the length of the key, the length of the text entered is 2n and a different number. Depending on the ideal result that you reach when using the GA and compared to the previous algorithms.

Comparing the results of our proposed techniques with other results
The performance of our model was compared with another technique developed by stream cipher and GA was also compared with another approach developed by reference [28], [29]. However, this reference [28] doesn't include any representation of its results in a form of table or figures. However, the results showed that the proposed scheme performs favorably better, reveals the higher performance of our proposed model. The runtimes of different text files are shown in Table 3.

CONCLUSION AND FUTURE WORK
This paper introduced a new text encryption and decryption technique using streamlined encryption and GA is characterized by the possibility of implementing it in the case of the availability of the applicable system. In addition to the difficulty of obtaining the encryption key within the ciphertext designed for optimal competence, the algorithm was implemented using the MATLAB program. Various parameters such as text and key lengths, calculation of encryption and decryption time, number of attempts to reach perfect encryption were tested. The simulated results show that the proposed scheme is very chaotic and robust and the throughput rate of the scheme (runtime) competes very favorably with existing similar schemes. The proposed method is also characterized by confidentiality due to the randomness of the key, which leads to hiding the statistical properties of the plaintext language and knowing part of the key sequence is not helpful in knowing all sequences are nonrecursive, as in the well-known linear and nonlinear shift registers. That is why the method is characterized by its stability in front of the known clear text attack. In future, it is also possible to rely on other intelligent techniques to generate the key, such as the use of neural networks. In addition to the possibility of integrating more than one encryption algorithm and benefiting from the GA by generating the key to it, and the use of the well-known camouflaging function that achieves the required specifications.