{'fraction_non_alphanumeric': 0.023355869698832205, 'fraction_numerical': 0.013912946303849807, 'mean_word_length': 4.8759028233749175, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Novel Design of Blowfish Algorithm for Image Security

In order to improve the security and efficiency of image encryption systems comprehensively an image encryption based on enhanced design of Blowfish scheme is proposed. The proposed system is employed block based image encryption technique combined with chaotic map properties. Firstly the digital image is scrambled and decomposed into several key based blocks randomly to decorrelated the relationship between original and processed image then each block is passed through an enhanced blowfish algorithm. The enhancement in design is to gain advantage of the strong facility, which is maintained by blowfish algorithm by overcoming its flaws, which leads to a significant improvement in security/performance. As a result the proposed system offers good performance for image encryption. The proposed algorithm is 320-bit Blowfish-like block cipher, where cascaded looking composition of F-functions is used instead of rounds. The key is accepted a variable length up to 400 bytes. The pragmatic aim of the proposed system is to decrease memory requirements and execution time while keeping the cipher simple and highly adaptable to future demands. To ensure improved encryption algorithm, the implementation of both techniques has been carried out for experimental purposes which is showed that the original image has a flat histogram after encrypted, a decreasing correlation between adjacent pixels in all color components and increasing entropy for the cases studied. The proposed algorithm has a sufficiently large key space and a very high sensitivity to the key. A comparative study with previous Blowfish algorithm shows the superiority of the modified algorithm.


Introduction
In nearly all our lives areas the visual information and images play a significant profession. Due to the significant growth in the computers usage, there is growing tendency for security of image and fidelity authentication. Transferred images are possessed various applications, like commercial, military, and medical applications. Therefore it is essential to cipher the data of image before it is sent through the network for preserving its security and avoid unlicensed access. Nevertheless, compared with text, further processing power and

Proposed System
To date, many data-encryption methods are suggested and commonly utilized, like AES, Blowfish, RC5, RSA, or IDEA. Most of them are employed for binary text file or binary data. These methods are difficult to use directly in multimedia data and is ineffective to encrypt color images due to the high correlation between pixels. Multimedia data is often high-frequency and requires real-time interactions. To dispel the high relation among pixels and raise the entropy value, an algorithm based on enhanced Blowfish combined with chaotic map is proposed where the chaotic is used as preprocessing step. Firstly the digital image is decomposed into several key based blocks randomly to decorrelated the relationship between original and processed image then these blocks are passed through an enhanced blowfish algorithm. The enhancement is design to take advantage of the powerful facility, which is supported by blowfish algorithm with overcoming its weaknesses, resulting in a much improved security/performance trade off. As a result the proposed system offers good performance for image encryption. The proposed algorithm is 320-bit Blowfish-like block cipher, where cascaded looking composition of F-functions is used instead of rounds. The key length is variable to 400 bytes. Beside the increased security, the pragmatic aim of the proposed system is to decrease memory requirements and execution time while keeping the cipher simple and highly adaptable for future demands. Figure 1 illustrates the block diagram of proposed algorithm.

Image Scrambling Based on Chaotic Map
The security issue can be solved by the high correlation between pixels and the large capacity of the data when encrypting an image. In the proposed system, the image is scrambling based on the chaotic map by generating a random sequence using Quadratic chaotic mapping [4] which is employed to scramble image pixels then generate another sequence using another initial condition and parameter of Quadratic chaotic mapping and normalize the range of the chaotic sequence to [1 10] and thus dividing the image into 10 blocks accordingly as shows in Figure 2. Figure 3 illustrates an example of the proposed scrambling method for 8×8 image based on Quadratic chaotic mapping.

Modified Blowfish Algorithm
The block size of traditional Blowfish algorithm is 64 bits [17] and this makes it vulnerable to birthday attacks, especially in contexts like HTTPS. In 2016, the SWEET32 attack showed how to take advantage of birthday attacks to perform invisible text recovery (i.e. decrypted text) against 64-bit block size [18]. The GnuPG project recommends that Blowfish not be used to encrypt files larger than 4 GB Because of the small size of the block [19]. The modified Blowfish algorithm has been enhanced by several techniques; firstly the block size and key length are increased to resist the birthday, matching and brute force attacks, secondly the key dependent permutation has been used to provide the necessary diffusion and confusion of the input block so that added differences are destroyed when the key alter. The modified Blowfish algorithm used one round of RC6 to input block as a reversible mixing function which is a more complicated. The previous blowfish algorithm used XOR as a reversible mixing function before the first and after the last round. The RC6 has been further confusing the entry values into the Substitution-Permutation Network (SPN) of proposed F-function and ensure a complete avalanche effect. The modified Blowfish algorithm is depicted in Figure 4  Modified Blowfish is Blowfish-like block cipher. The plaintext is 320 bit which is divided into 10 parts Blocki where i=1.. 10. Each of part is 32 bits. The F function in proposed scheme will be used the cascaded design instead of rounds. The output is 320 bits Ei where i=1…10 of 32 bits. Algorithm of enhanced Blowfish algorithm is showed in algorithm (3).
The decryption operation of proposed algorithm is the inverse of the encryption operation and the code for decryption is similar.

The Design of F-function
The structure of proposed F-function is a usual Substitution-Permutation Network (SPN), which is also employed in numerous block ciphers, e.g. AES, Twofish, Serpent and RC6. In our first estimation for obtaining a reasonable margin of security and asymmetric iteration, the cascaded design choose the size of block and dependently determine the minimum number of rounds Nr of the first output E1 as 12 while the maximum Nr as 30 for last output E10. It is may be safe to decrease the iteration numbers from 16 to 8 without compromising security [20]. The iteration numbers essential for security may depend on key length. As seen with the current subkeys construction procedure, a 12-iteration algorithm cannot accept a key longer than 3200 bits compared with traditional blowfish which is accept key longer than 768 bits. Figure 11 shows the architecture of F-function which is took four inputs and four outputs and ten additional integer parameters represented subkeys. A more difficult integrating function is used to ovoid symmetries. One round of RC6 [21] is employed as a reversible mixing function which is a more complicated reversible mixing function compared with XOR which is used as reversible mixing function before after the FB functions. Algorithm (4) lists the steps of the F function.
In the modified scheme Blocki is divided into four 8-bit quarters a, b, c, and d. Each quarter is indexed to the one of the S-boxes and entries to a single S-box are overlapped: entry 0 involves of bytes 0 through 3, entry 1 through 1 to 4, etc. This simplification will be decrease the requirements of memory for the S-boxes in traditional Blowfish algorithm from 4×4×255 (i.e., 4069 bytes) to 4×255 (i.e., 1024). A more complex combining function in the proposed system is used to eliminate the symmetries represented by one round of RC6. Figure  (12) depicts the FB function of proposed scheme.
In the design of the F function a combination of different operations is used in a way that will increase the advantages from each. Some of the characteristics of this function are: a) The complexity of proposal algorithm will be increased by using combinations of basic operations. Hence by using F function a diffusion and confusion to the outputs of S-boxes are achieved. The permutations in proposed algorithm are key dependent so that it could avoid linking plaintexts to input to the first F function and ciphertexts to input to the last F-function. An F function will be used a combinations of basic operations to achieve a large number of encryption functions, i.e. permutations of binary n-bit vectors, high structural complexity. b) The rotations that are dependent on data can be accomplished rapidly in software and hardware. Joining with mathematics operations like addition. These combining operations are very active against linear cryptanalysis. c) The Proposed algorithm is aimed to use a full list of "strong operations" supported in modern computers to attain well security, high speed, and execution flexibility. Proposal algorithm is used primitive operations (add, subtract, multiply, exclusive-or, and datadependent rotate). The proposal algorithm is resistance against linear and differential attacks by using four key dependent (S-box) tables of 255 each entry is 32-bit.

Subkeys
The range of values to be taken by the key has become large. A large key space is necessary to prevent exhaustive search for a key. The proposed system still uses the same key generation process because it is designed to keep the entire key entropy and to distribute this entropy uniformly across the subkey. It is also designed to randomly the permissible subkey set throughout the possible domain of possible subkey [20].
Data encryption or decryption required the P-array and S-boxes are precomputed. The same procedure, which is used in the previous Blowfish algorithm, is used in this work to generate these subkeys.

Experimental Results
The experiments are conducted on different standard images with different characteristics such as more details and large areas with the same color. These color images of size 256×256 are 'Lena', 'A', 'Nike', "Baboon', 'Duck' and 'Airplane' as shown in Figure  13. Figure 16 illustrates the original tests images with corresponding permuted and encrypted images by proposed algorithm. As it noticed that the encrypted image is similar to noise image, and there is no relationship with the original image. Thus, the encryption effect is good. While Figure 14 shows the 'Lena', 'A' and 'Nike' test images after encrypted them with traditional Blowfish algorithm. It can be seen that the Blowfish algorithm is not suitable for image encrypting although it an excellent symmetric cryptosystem the reason for this is that the image data is huge and contains more redundancy than the text data. Encrypted image by proposed system.

Key Space
The large key space is essential to avoid comprehensive search for a key (Solve the problem of discovery the exact key value by trying potential values until the correct key is found). The proposed system employed Quadratic map which is used two independent variables x0 and a. As a result, the key space is {X0, a}. Since X0 and a are double precision numbers, the total number of different values for X0 and a is more than 10 14 . The used secret keys are six initial conditions X0, X0 ' , X1, X1 ' , X2, and X2 ' with six parameters a1, a1 ' , a2, a2 ' , a3 and a3). So, the key space is larger than (10 14 ) 12 = 10 168 ≈ 2 558 . The key space of enhanced blowfish algorithm is 2 400 the total key space of proposed system is 2 958 . The key space between the used algorithm and other similar encryption algorithms is compared as shown in Table 1. It is clear that utilized algorithm's key space size is larger than that of most similar algorithms. Key space for our improved encryption scheme is decently large

Matching Ciphertext Attack
The 320-bit block size is required to 2 320 ciphertexts and this makes the suggested system resistant to corresponding ciphertext attack. Then after the blocks are encrypted, equal ciphertexts can be predictable and information about plaintext is leaked. In the traditional blowfish algorithm with 64-bit block size is required to 2 64 ciphertexts [29].

Memory Requirement
One of the aims of the enhanced Blowfish algorithm is to reduce the memory requirement without compromising security. Hence, the size of S-boxes of Blowfish is reduced.

Statistical Analysis
In this section the statistical analyses are conducted on test images represented by information entropy, histogram analysis, and correlation analysis as explained in next subsections.

Histogram Analysis
The histogram cans reflect the accurate representation of pixel value distribution. For desirable cryptographic results, the histogram of the encryption image is always uniform. Figure 17 is the original test images, Figure 15 is the histograms of 'lena', 'A' and 'nike' test images, Figure 16 is the histograms of encrypted images by Blowfish algorithm while Figure  17 show the histograms of encrypted images by proposed algorithm. As seen that the experimental results are distributed uniformly, which are totally different from Airfield's. Therefore, the proposed algorithm has effective resistance from statistical attack.

Entropy Analysis
Entropy is defined as measure of image information content, which is meant the average number of bits of the gray levels of an image. An increasing in the value of entropy means an increasing in the confusion of information delivered by the image. For discrete 2D images the information entropy E is evaluated using equation (2) Where, pi is a gray value probability. When the probability of distributing information is equal to the encrypted image, that is, the probability of each pixel value of [0, 255] is 1/256, maximum entropy is 8 bits.The more confusing information provided by the image will be gave higher entropy. The information entropy of test images is listed in Table 3 and the information entropy of the ciphered images attained by Blowfish algorithm is listed too. Table 4 lists the information entropy of proposed algorithm for test images. Note that the entropy of the encrypted image information for all test images is very nearby to 8 bits and that the suggested algorithm has a greater dominance.

Correlation Analysis
To increase the level of security in the image we must reduce the correlation between adjacent pixels of the original image. It is noticed that a slight difference in the value of gray in the larger area of the original image. Thus, encryption must have a strong effect on the image. As a test, the correlation coefficients of all adjacent pixels in the three directions, including the vertical, horizontal and diagonal directions are calculated using Equation (3)  The two adjacent pixel values from four directions are represented by x, y, and N is image pixels' number. The correlation distribution map for R, G, and B bands in horizontal, vertical and diagonal directions for original 'lena, 'A' and 'nike' are depicted in Figure 18. The encrypted images by Blowfish and encrypted images by proposed system are drawn and shown in Figure 19 and Figure 20 recpectively. Note that in the original images there is a high correlation between adjacent pixels, viewing a linear relationship, this correlation is critically weakened, and for ciphered images viewing a robust randomness. This indicates that the effectiveness of image encryption is good and higher security level. The proposed method is compared with other methods, while using entropy correlation analysis for the "Lena" image of size 256 × 256 in Table (5). Table 5. Performance comparisons with other methods From the observation of Table 5, the Correlation Coefficients of the encrypted 'Lena' image using the proposed algorithm are closer to zero than original Blowfish and other researchers, indicating that the encrypted image pixels using the proposed algorithm are highly uncorrelated and cannot predict each other which mean that the proposed algorithm is more secure.

NPCR and UACI Analysis
NPCR and UACI tests, measures the ability of cryptographic system to resist the differential attack. The results of NPCR and UACI tests in Table 6. When the NPCR and UACI of the ciphertext are greater than 99.6% and 33.46%, respectively [36], it indicates that the algorithm has good security combared with traditional Blowfish algorithm and thus the values of the proposed algorithm are closer to the theoretical value than the original Blowfish. Hence, the proposed algorithm is powerfully able to resist differential attacks.

Measure
Li et al.

Conclusions
The proposed algorithm is 320-bit Blowfish-like block cipher, where cascaded design of composition for F-functions is used instead of rounds. The key can be any length up to 400 bytes. The design philosophy of proposed algorithm depends on mixing operation from different algebraic group: XOR, addition, and multiplication. The main aim of proposed algorithm is reduced memory requirement without compromising security. The proposed algorithm is a fast and secure symmetric-key block cipher with a cascaded structure. It offers much improved security/performance over traditional blowfish cipher to gain advantage of the powerful operations reinforced in today's computers. Because of the law memory requirement, it may be easily to implement on smart cards or other devices with restricted memory.