Improved Blowfish Algorithm based Secure Routing Technique in IoT based WSN

Internet of Things (IoT) has gained popularity with the growth and prospects of smart networks. It is intended to exploit the network edges, which enables smart service and assessment for IoT. Moreover, this exploitation not only improves the user experiences but also provides service resiliencies at any catastrophe. The IoT appliances deploy distributed structure and proximity of end-users to offer quicker responses and improved quality of service (QoS). Nevertheless, security is mainly considered to resist the susceptibility of attacks. This work aims to introduce a novel secure routing model by carrying out optimal path selection and encryption. Initially, optimal link-state multipath routing takes place, where optimal paths or nodes are chosen for secure transmission. For optimal path selection destination and source, a Crossover Mutated Marriage in Honey Bee (CM-MH) algorithm is developed and proposed in this work. Next, encryption takes place that ensures secure transmission. In this research, an Improved Blowfish algorithm (IBFA) is proposed for secured authentication. Finally, the updates are monitored. At last, the supremacy of the developed approach is examined via evaluation over numerous existing techniques.


I. INTRODUCTION
"IoT refers to the rapidly growing network of connected objects that are able to collect and exchange data in real time using embedded sensors" [1][2]. The modelling of IoT should pay attention to multiple issues regarding communication and interconnection. There are numerous appliances in day-to-day life, where we employ sensors, laptops, mobile phones and household equipment namely, fridge, air conditioner, coffee maker, washing machines and microwave oven, which are gathered with IoT for carrying out a lot of activities [3][4][5]. In addition, IoT can be utilized together with vehicles using VANETs and it could be deployed for data collection routing [6][7][8].
The use of IoT devices has expanded tremendously as information and communication technologies have advanced. WSNs play an important role in the growth of the Internet of Things, and they are made up of low-cost smart devices that collect data. On the other hand, smart gadgets have limitations in terms of computing, processing, memory, and energy resources. Along with these limits, one of the most important problems for WSN is to accomplish reliability while maintaining data security in a vulnerable environment against malicious nodes. In IoT, WSNs is a significant element, which has concerned IoT and networking communities [9][10][11][12] [41][42][43][44]. Offering securities with optimal energy is a tough task in WSNs while nodes are mobile, as controlling nodes' movement and moving adversaries is crucial regarding security. There are different types of attacks formed by adversaries [13]. A WSN with satisfactory software and hardware could seize the transferring data in an unauthentic manner [14][15][16][17].
To overcome such susceptible attacks or activities, IDS is deployed practically. IDS [18][19] is chiefly deployed in wired systems with the exploitation of h/w systems among nodes or servers to observe the network's activities. Conventionally, IDS-oriented learning schemes were considered for evaluating existing networks i.e. not particularly for IoT systems [20]. Hence, it is essential to model the WSN nodes with EE, to formulate the associated protocols to enhance entire network quality with security while routing [20][21][22][23][24].
The major contributions are as follows.

As a novelty, this work proposes a new Crossover
Mutated Marriage in Honey Bee model for optimal path selection between destination and source.
2. Also, it introduces an improved blowfish approach for secure data transmission.
The paper is organized as follows: Section II reviews the work. The developed Secure Routing Model in IoT-based WSN is illustrated in Section III. Link state multipath routing via optimal path selection is portrayed in Section IV. Section V portrays secure transmission via an improved blowfish model. Section VI and Section VII explain the results and conclusion.

A. RELATED WORKS
In 2019, Thangaramya et al. [8] have focused on enhancing the network using intellectual schemes, by which proficient routing decisions were made. Eventually, analysis was carried out and the accomplished outcomes have proved the efficacy of the proposed scheme about delay, lifetime, and PDR.
In 2020, Deebak and Fadi [24] established a new secure routing protocol via TF symmetric key model for recognizing and avoiding the challenges in the overall WSN. At last, the results accomplished using the adopted model have revealed its superiority over other models; and thereby, the multipath delivery was assured.
In 2020, Mauro et al. [25] have established a new scheme termed as SARP that resulted in effective routing in IoT networks. In addition, the adopted scheme helped in reducing the delay ratio, overhead and energy utilization, thus enhancing the effectiveness of the system performance.
In 2019, David et al. [26] have introduced a routing model termed as SecTrust-RPL for safeguarding the IoT from various types of attacks. Further, the efficacy of the adopted scheme was computed over another protocol, and its enhancement was established regarding robustness and efficiency.
In 2019, Lake et al. [27] adopted a robust and secure technique that facilitated the transmission of private information in IoT networks. Furthermore, the adopted scheme has assured the integrity and privacy of data even if there were more collusive and sophisticated attackers who could hijack the device.
In 2019, Liu et al. [28] have implemented a technique, which exploited both "K-means and perceptron" approaches for evaluating the trust values of IoT nodes and it also detected various malevolent nodes. To enhance the detection accuracy, the routing network was optimized via the PDE model. In the end, the accomplished resultants illustrated the superiority of the implemented scheme in detecting the malevolent node and eliminating it efficiently.
In 2020, Waqas et al. [29] have presented a novel QCM2R technique for WSNs. Accordingly, for verifying the enhancement of "QCM2R protocol", implementations were done that demonstrated the superiority of the adopted model with regard to various measures like reliability, throughput, delay and life span.
In 2020, Badis et al. [30] adopted a "secured trust management and multipath routing model", which were adapted to various scenarios in IoT networks. Finally, the simulated outcomes exposed the supremacy of the presented approach regarding scalability, efficiency and security.
In 2020, Shende, D.K. and Sonavane [39] have presented an energy-aware multicast routing protocol using the CrowWhale-ETR on the basis of objective function designed with the energy as well as trust factors of the nodes. To establish the routes that are chosen optimally utilizing CWOA, the nodes' confidence and energy are first examined. This ideally chosen path is utilized for data transmission, in which the energy and trust of each node are updated at the end of each individual transmission, allowing for the selection of secure nodes and improving network security. From the analysis, it can be noticed that the proposed method attains minimal delay, maximal detection rate, energy and throughput in the presence and absence of attacks.
In 2020, Rahim [40] have suggested a Taylor-based Grey Wolf Optimization algorithm (TGWOA) to overcome the energy issue in WSN. The introduced method is the integration of the Taylor series with Grey Wolf Optimization, which helps in finding optimal hops to attain multi-hop routing. The aim of this method is to secure routing for conserving energy efficiently during routing. The presented method attains better performance of 23.8% of energy and 53.2% of network lifetime. Table I illustrates the review on secure routing in IoT-based WSNs. Shende, D.K. and Sonavane [39] CWOA  Maximum throughput  There is a need to determine the optimal routes to enable effective routing Rahim [40] TGWOA  Improved scalability.  The lifetime of the network is very low

B. RESEARCH GAP
 Numerous approaches have been focused on IoTbased WSN systems.  However, the presented approaches are complex in terms of local path repair and issues due to depleted battery power and so on.  Hence there is a need to propose a new secure routing model.  This work aims to introduce a novel secure routing model.  This is done by the optimal path selection and encryption using the CM-MH algorithm.  In addition, an improved blowfish approach is introduced to secure data transmission. Fig. 1 demonstrates the adopted secure routing in IoT-based WSN. The IoT-based WSN is an innovatory scheme for smart monitoring. This allows the development of grid sharing for maintaining power quality. The IoT data transfer is done via the Thingspeak application. Thingspeak is a web-based open (API) IoT source information platform that can store sensor data from a variety of "IoT applications" and display it in graphical form on the web. Thingspeak communicates with the host microcontroller via an internet connection that acts as a "data packet" carrier between the connected "things" and the Thingspeak cloud, which retrieves, saves/stores, analyses, observes, and works on the sensed data from the associated sensor to the host microcontroller. The presented approach includes two stages, namely: (a) Link state multipath routing via optimal path selection and (b) secured transmission by Improved Blowfish algorithm. Initially, the network is generated. Further, optimal path selection is carried out, in which the optimal paths are chosen for data transmission. Here, optimal path selection is carried out by considering the constraints such as energy, delay, distance and trust. The use of energy is regarded as an essential concern in the WSN. In reality, if the battery in the WSN is employed, there will be no way to re-energize it, and there will be no power supply. In general, as the network performs multiple operations such as receiving, transmission, aggregation, and sensing, it consumes more energy. In this work, the energy is calculated b`y taking the mean of energy of nodes in the path. The trust is determined by the mean of trust of nodes in the path. Further, the distance is the distance among the nodes. After selecting the optimal paths for multipath routing, it is necessary to transmit the data securely through the paths. For secure transmission, this work deploys an improved blowfish algorithm. In addition, optimal path selection is carried out by exploiting the CM-MH model that aids in attaining the defined objective function precisely with optimal training.

A. NETWORK GENERATION
Herein, the node counts are assigned for three variations, namely, 50, 100 and 150. The network area is fixed as 100 × 100. Moreover, each node is allocated with energy, distance, delay and trust.

(a) Energy
The energy consumption model declares the network model, which decreases energy in different operations such as transmission, reception, sensing, and idle state [48]. The energy is defined as the mean of energy of nodes in the path.
The Euclidean distance is evaluated based on the distance computed between the nodes in the paths [49].

(c) Delay
The delay is termed as the time spent for the data packet to arrive at the destination [49].

(d) Trust
In this paradigm, trust is an important metric since it is preferable to choose a trusted node with lower power levels than an unreliable node with higher power levels. Furthermore, when determining the weights of nodes, the trusted node is given a higher priority. Trust is calculated by taking the mean of trust nodes in the path [50].

B. OPTIMAL PATH SELECTION
Here, the optimal path selection is carried out by determining the minimum distance, delay, and assigned trust of the node. Then, the transmission of data can be done by selecting the optimal path between source and destination. Here, a multipath selection process can be done. The forwarding nodes from multi-channels are selected. The multipaths are selected using the CM-MH algorithm.

C. OBJECTIVE FUNCTION AND SOLUTION ENCODING FOR OPTIMAL PATH SELECTION
In this work, the paths are optimally chosen for carrying out the data transmission. For this, a new CM-MH approach is introduced. The input solution to the proposed algorithm is shown in Fig. 2, wherein the paths with 0 values are dropped and the paths with 1's are chosen as optimal paths. The chromosome length will be equivalent to the count of nodes in each path. The objective function of the developed model denoted by Obj is given in Eq. (1), wherein w signifies the weights that are randomly generated among 0 and 1 (i.e. 1 De refers to delay, E refers to energy and T refers to trust. (1)

D. PROPOSED CM-MH MODEL
The existing MHBO model [21] reveals optimal solutions; however, it endures from low precision. To overcome the disadvantages of traditional MHBO, certain improvements are performed in the adopted algorithm. Self-improvements are established to be promising in existing optimization algorithms [13] [16][17] [22][23] [31][32][33]. MHBO tends to design the marrying behaviour of honey-bee in a bee-hive colony. A colony of honey bees usually is made of drones, queen(s), broods, and workers. Each member includes a definite task to perform in the colonies. The queen will be the mother of every other bee in colonies. The principal purpose of the queen is laying eggs to generate offspring. The drone is the father of a colony. The only job of the drone is to situate and mate with the queen throughout the mating flight. During marriage procedure, the queen begin joggle dance before flying far away from hives with the intention of mating with the drones, generally from another colony. The queens normally mate with the drones, which flutter the maximum and are capable of catching her. After mating, the drone instantaneously dies. The queen carries on mating till her spermatheca, wherein, the sperm of drones are accumulated, is filled. When her spermatheca is filled of sperms, the queen returns to the hive and begins laying both unfertilized and fertilized eggs. The queens lay eggs by arbitrarily recovering sperms from spermatheca for fertilizing the eggs. Actually, only workers and queens come up from fertilized eggs, whereas drones come up from unfertilized ones. Workers are feminine bees that perform every works in the colony, for example, brood care, nest creation, feeding, and food foraging.
The MHBO is separated into the 4 most important phases. The primary phase begins with initializing the constraints of the MHBO algorithm. The constraints desired to be described are the count of queens, the mutation rate, worker's count, and mating flight count, count of prospective broods, drone count, and queen's spermatheca dimension. The subsequent stage is the mating procedure. Before the mating flight, both the speed and energy of every queen are arbitrarily assigned with values in the ranges among [0.5, 1].
All through the mating flights, queens mate with a drone, including the higher marriage probability as shown in Eq. (2).
In Eq. (2) whilst the speed of the queen is higher or the fitness of drones is as superior as the queen. If mating is a success, the genotype of the chosen drone is stored in the spermatheca of queen. After every conversion, the queen's speed and energy decline based on Eq. (3) and Eq. (6). Conventionally, the speed gets updated based on  and   t P . In which  refers to decay factor that includes a value among 0 and 1 and   t P refers to speed of queen at time t . As per the CM-MH scheme, the update takes place based on levy as shown in Eq. (3).
The Levy flight is evaluated by Eq. (4), where c is a constant factor and 1 r and 2 r are the random numbers between In Eq. (6),   t En refers to queen's energy at time t ;  refers to the quantity of energy diminution following every transition, is evaluated as in Eq. In Eq. (7), Q refers to size of the spermatheca of the queen. The queen tends to mate with another drone till her energy gets minimized than the fixed value of min En is full. Subsequently, the queen goes back to hives to start its breed.
The 3 rd phase is the "breeding and feeding process". When every queen finishes their mating flights, the breeding procedure starts. Similar to GA, the breeding procedure is depending on 3 functions of selection; mutation and crossover. In the existing model, a novel brood is produced by the crossover of queen's genotype with chosen sperm's genotype and then the mutation is performed to novel brood for providing better solutions. However, as per the adopted model, multi-point crossover and scramble mutation takes place. As per the proposed scramble mutation, a subset of genes is selected from the chromosome and their values are scrambled arbitrarily. Moreover, while carrying out the proposed multipoint crossover, the alternating segments are exchanged to attain novel offsprings. End for Produce broods as per proposed scramble mutation and multi-point crossover utilize workers for enhance the broods Update fitness of workers While the best brood is better than the worst queen substitute least fit queen with better brood eliminate the enhanced brood end while end for

A. IMPROVED BLOWFISH ALGORITHM (IBFA)
In 1993, Bruce modelled blowfish as a free, fast substitute to conventional encryption approaches. It is gradually attaining recognition as a stronger encryption approach.
The Blowfish approach has numerous benefits [45]. It is efficient and appropriate for hardware execution and no license is necessary [34]. The basic operators of the Blowfish approach consist of XOR, addition and table lookup. Some stipulations of the Blowfish approach are given in the below lines:  Contains 64 bit blocks cipher with an uneven key length.
 Contains four 32-bit P -boxes and S -array. The S -array includes 18 of 32-bit sub-keys, whereas every P -box includes 256 entries.  The approach includes two elements: "a keyexpansion part and a data-encryption part".
 The input is a data element of 64 bits.
The F operation deploys the substitution boxes, where there are 4, every one comprising 256 32-bit entries [35].
is specified by Eq. (8). As per the improved blowfish model,   XL F is formulated as shown in Eq. (9). Moreover, 64 bits of data is separated into four blocks with 16 bits per block each. As per the developed work, 256 bits key is separated into four equal 64-bit keys, which is shown in Fig 3 and 4.

Case 1:
Thus, the enhanced blowfish model securely broadcasts the messages to the destination.

A. SIMULATION SETUP
The introduced secure routing model via CM-MH was executed in Matlab with ThingSpeak. Here, in the IoT environment data transfer is done via ThingSpeak. The analysis of the proposed model was done with respect to CCA and CPA attacks by varying the size of data bits from 3KB, 5 KB and 7KB. Consequently, the enhancement of the developed CM-MH model was measured by evaluating it over extant schemes, namely PSO [36], FF [37], GA [38] and MHBO [21], TGWOA [39], and CWOA [40] models. Here, convergence analysis was computed for different iterations that range from 0, 5, 10, 15, 20 and 25 for three-node variations, namely, 50, 100 and 150. In addition, encryption, as well as decryption time, were examined along with throughput computation by varying the size of data bits from 3KB, 5 KB and 7KB. The simulation parameter is illustrated in Table II. Network Area 100*100 3.
Node Energy Selected randomly between 0 and 1 4.
Node Trust selected randomly between 0 and 1 Table III describes the total cost analysis attained by the  presented approach over extant approaches for varied counts  of nodes, namely, 50, 100 and 150. The total cost is calculated by considering the energy, delay, distance, and trust. Further, the analysis on distance, energy, trust and delay are summarized in Table IV, V, VI, and VII, respectively. On noticing the examination resultants, the developed CM-MH model has obtained minimal cost values for all counts of node variations compared to the existing schemes. This ensures optimal path selection and secured data transmission by the proposed model. More particularly, the adopted scheme has achieved a least-cost value of 0.3236 while the node count is 50. That is, the developed approach is 25.45%, 32.72%, 25.88%, 29.11%, 28.71% and 29.11% enhanced than extant PSO, FF, GA, MHBO, TGWOA, and CWOA models when the node count is 50. In addition, the analysis on distance attained by the presented model over extant approaches for varied counts of nodes is shown in Table IV. The distance among node has to be minimal for the improved system performances. On noticing Table IV, the adopted scheme has attained a minimal distance value (0.6533) when the count of node is 50. The adopted scheme is 7.76%, 27.88%, 19.54%, 28.60%, 22.43% and 28.60%, superior to traditional PSO, FF, GA, MHBO, TGWOA, and CWOA models. Likewise, when the node count is 150, the developed scheme has attained with a high trust value of 0.58136 than the extant approaches, thus making sure about the betterment of secured transmission of the introduced model. Thus proves the betterment of the suggested scheme over other conventional models.

C. THROUGHPUT ANALYSIS
The throughput analysis of the developed CM-MH model is evaluated over extant models by varying the size of data bits from 3KB, 5 KB and 7KB. "The throughput of the encryption scheme is calculated by dividing the total plaintext in Megabytes encrypted on the total encryption time for each algorithm" [46]. On analyzing the graphs, the presented CM-MH model has obtained better throughput values than compared schemes. In particular, higher throughput values guarantee the enhanced performance of the model. From Fig.  3, the presented CM-MH model has achieved a better throughput value, which is 56.67%, 76.67% and 13.79% improved than AES, RSA and BFA models when the counts of data bits is 3 KB. Thus, the adopted CM-MH model offered better throughput for every bit count.  Fig. 6 (a), 6 (b) and 6 (c) correspondingly. On focusing the results, the adopted approach has obtained minimal cost values for all iterations when evaluated over the extant models. From the graph, the presented model accomplishes a reduced cost value for the 25 th iteration when the node count is 150. On noticing cost function from Fig. 6 (a), the developed model has attained minimal cost value that is 0.92%, 5.54%, 4.85%, 5.54%, 2.15%, and 2.32% superior to traditional PSO, FF, GA MHBO, TGWOA, and CWOA models, when the iteration is 25. Also, from Fig. 6 (c), the adopted scheme has attained minimal cost value when the iteration is 25, which is 2.02%, 2.31%, 2.88%, 5.19%, 0.7%, and 0.35% superior to traditional PSO, FF, GA MHBO, TGWOA, and CWOA models. Thus, the overall evaluation illustrates the effectiveness of the CM-MH scheme in attaining better results.

E. ATTACK ANALYSIS
The attack analysis for proposed IBFA over conventional models is shown in Fig. 7. Fig. 7(a) and Fig. 7(b) reveal the analysis on attacks such as CPA and CCA in that order. "CCA is an attack model for cryptanalysis in which the cryptanalyst gathers information, at least in part, by choosing a ciphertext and obtaining its decryption under an unknown key" [47]. "During the CPA, a cryptanalyst can select arbitrary plaintext data to be encrypted and then he receives the corresponding ciphertext" [47]. Here, if the correlation between both the original text and hacked text are similar, then the value ranges between 0 to 1. From the graph, it can be noticed that the proposed CM-MH algorithm attains a negative value in Fig.  7(a) and Fig.7(b), which shows that the correlation between both the original text and hacked text is very low than the existing models like AES, RSA and BFA. Hence, it is evident that the proposed scheme cannot get hacked easily than other existing models. The attack performance of adopted CM-MH attained better outcomes than the extant schemes like AES, RSA and BFA, respectively. Moreover, the CCA performance of the developed model from Fig. 7(a) attained a minimal value of 0.08, which is 90%, 73.33% and 62.5% improved than AES, RSA and BFA models when the counts of data bits is 3 KB. This shows the betterment of the proposed CM-MH secured data transmission.

F. COMPUTATIONAL TIME ANALYSIS
The encryption, and decryption time taken by the developed IBFA model, is evaluated over extant models by varying the size of data bits from 3KB, 5 KB and 7KB. Consequently, the results for encryption time and decryption are time exposed in Fig. 8 (a) and Fig.8 (b) in that order. On analyzing the Tables, the presented IBFA model has obtained better outcomes than compared schemes. In particular, minimal time values guarantee the enhanced performance of the model with minimal computational time. From Fig. 8 (a), the presented IBFA model has achieved minimal encryption time value, which is 60%, 75% and 50% improved than AES, RSA and BFA models when the counts of data bit is 3 KB. Moreover, the presented IBFA model has achieved negligible decryption time value, which is 40%, 80.77% and 20% improved than AES, RSA and BFA models when the counts of data bit is 5 KB. These analyses have proved the supremacy of the proposed IBFA model in quicker computation on secured data transmission.

VII. CONCLUSION
This paper introduces a new secure routing model by carrying out optimal path selection and encryption. At first, the optimal link-state multipath routing was performed in which the optimal paths or nodes were selected for secure transmission. Moreover, the CM-MH algorithm is proposed to select the optimal path. Besides, encryption takes place using improved BFA that ensures secure transmission. On noticing the resultants, the developed approach attained a minimal distance value (0.7933) when the count of the node is 50. That is, the adopted scheme was 2.35%, 15.35%, 6.18% and 15.35% superior to traditional PSO, FF, GA and MHBO models. Likewise, when the node count is 150, the developed scheme has attained a superior trust value of 0.58136, which was higher than the extant approaches. Moreover, the presented CM-MH model has achieved negligible decryption time value, which was 40%, 80.77% and 20% improved than AES, RSA and BFA models when the counts of data bits is 5 KB. Thus the efficacy of the developed CM-MH method was confirmed from the outcomes.