# An Image Hashing-Based Authentication and Secure Group Communication Scheme for IoT-Enabled MANETs
## 4 Proposed Image Hashing-Based Authentication Scheme
### Node Migration Algorithm  
In the case of node migration, a request message is sent to \(GH_{i}\). After receiving a request from the \(Ni\), the \(GH_{i}\) informs node members. Next, the \(GH_{i}\) transfers security credentials to destination group \(GH_{j}\). The node migration mechanism is explored in a stepwise manner in Algorithm 2.  
In this scenario, the node \(Ni\) leaves the current group \(GH_{i}\) to migrate to the remote group \(GH_{j}\). First of all, \(Ni\) forwards the migration request message to the current \(GH_{i}\). The request message \(\left\{ID_{Ni},\ RN_{Ni},\ M_{req}\right\}\) is encrypted using the public key \(K_{G_{Hi}}\) of \(GH_{i}\). Then, the \(GH_{i}\) forwards the message \(\left\{ID_{Ni},\ RN_{GH},\ K_{G_{Hi}}\right\}\) by encrypting with \(K_{Ni}\) as a public key of the \(Ni\). This reply message also includes the \(K_{G_{Hi}}\) as a public key of the remote \(GH_{j}\), as \(Ni\) will forward the security credentials to the \(GH_{j}\) for authentication at the time of joining. Moreover, \(GH_{i}\) also forwards the encrypted message, \(EM_{GH_{i}}=K_{G_{Hi}}\left\{ID_{GH_{i}},\ T_{GH_{i}},\ RN_{GH_{i}},\ H\big{(}M_{ GH_{i}}\big{)}\right\}\), to the \(GH_{j}\) for authentication purposes. After receiving the security credentials, the \(GH_{j}\) verifies the differences in timestamps as \(T_{GH_{i}}-T_{GH_{j}}\), which should be less than the threshold time \(\Delta t\). If the timestamp is greater than the threshold value, then the migration request is discarded, and the re-send request is transmitted to the \(GH_{i}\). Otherwise, the \(GH_{j}\) will receive the message, \(\left\{ID_{Ni},\ TN_{Ni},\ RN_{Ni},\ H(M_{Ni})\right\}\), from the \(Ni\), encrypted using \(K_{G_{Hi^{\prime}}}\) to join the new group when the \(Ni\) reaches the remote group.  
\(GH_{j}\) verifies that the differences in time stamps (\(T_{Ni_{i}}-T_{GH_{j}}\)) are lower than the threshold \(\Delta t\). In the case of an outdated message, the received message is discarded. Otherwise, \(GH_{j}\) further compares the hashes \(H(M_{Ni})\) and \(H(M_{NA})\) for the verification of message integrity. When both the hashes are matched, \(GH_{i}\) accepts the migration and join request of the \(Ni\) and stores its information in the group table. Otherwise, the migration and join requests fail, and this node is considered as an unauthenticated node or attacker. The scenario of intergroup migration is shown in Figure 3.  
The proposed scheme is evaluated for providing security against the reply attack by including the timestamp and recording the differences between timestamps at the receiving side. This scheme ensures the challenge response from the nodes to ensure authentication and provides secure access control. It involves the hash of values to ensure message integrity against bit-alteration attacks. The image hashing ensures the efficient comparison among the images to reduce computational costs. The proposed scheme ensures that the intruder cannot forge the security parameters taken from the intermediary node traveling from one group to another due to a join or migration operation.