# An Image Hashing-Based Authentication and Secure Group Communication Scheme for IoT-Enabled MANETs
## 4 Proposed Image Hashing-Based Authentication Scheme
### Node Joining Algorithm  
In this scenario, the node joining mechanism is explored where the node (\(Ni\)) joins a specific group, \(GH_{i}\). First of all, \(Ni\) transmits the join request to \(GH_{i}\) in the form of an encrypted message, as shown in Equations (1) and (2). \begin{table}
\begin{tabular}{l c} \hline \hline  & **Symbol** & **Description** \\ \hline \(1D_{Ni}\) & Node ID \\ \(T\) & Timestamp \\ RN & Nonce value \\ \(H\) & Hash function \\ \(TS\) & Time stamp \\ \(GH_{i}\), \(GH_{j}\) & Group heads in the network \\ \(K_{G_{nn}}\), \(K_{G_{nj}}\) & Public keys of \(GH_{i}\) and \(GH_{j}\) \\ \(NA\) & Network administrator \\ \(K_{NA}\) & Public key of NA \\ \(M_{Ni}\) & Concatenated message of node security credentials \\ \(EM_{GH_{i^{\prime}}}\), \(EM_{Ni}\) & Encrypted message of node \(GH_{i}\) and node \(Ni\) \\ \(H(M_{Ni})\), \(H(M_{GH_{i}})\) & Image and security credential hash of node \(Ni\) and node \(GH_{i}\) \\ \(K_{N_{A^{\prime}}}\), \(K_{G_{ni}}\) & Public key of node \(Ni\) and node \(GH_{i}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: List of notations for the proposed approach. Figure 2: Mobility of node from one group to the other in a secure manner. \[M_{Ni}=(login\_ID_{Ni}\ ||\ pwd_{Ni}||\ IMG_{Ni}) \tag{1}\]  
\[EM_{Ni}=K_{G_{H}}\ \{ID_{Ni},\ T_{Ni},\ RN_{Ni},\ H(M_{Ni})\} \tag{2}\]  
The message \(M_{Ni}\) comprises the login ID (\(login\_ID_{Ni}\)), the password (\(pwd_{Ni}\)), and a hash of the soldier image \(IMG_{Ni}\). The soldier acts as a node and is represented as \(Ni\). Moreover, \(EM_{Ni}\) includes the node ID (\(ID_{Ni}\)), timestamp (\(T_{Ni}\)), nonce value (\(RN_{Ni}\)), and a hash of (\(M_{Ni}\)) encrypted with the public key (\(K_{G_{Hi}}\)) of the \(GH_{i}\). After receiving the join request, the \(GH_{i}\) checks the timestamp of the received message (\(T_{Ni}-T_{GH_{i}}\)) < \(\Delta\)t. If the timestamp is greater than the threshold value, then the message is discarded and a request to resend the join request is sent. Otherwise, the \(GH_{i}\) transmits the request message \(\{ID_{GH_{i}},\ T_{GH_{i}},\ RN_{GH_{i}},\ Req\ (ID_{Ni})\}\) to the \(NA\) by its public key, \(K_{N_{A}}\), for encryption. Then, the \(NA\) forwards the required information based on the \(ID_{Ni}\), as shown in Equations (3) and (4). \[M_{NA}=(login\_ID_{NA}\ ||\ pwd_{NA}||\ IMG_{NA}) \tag{3}\]  
\[EM_{NA}=K_{G_{H}}\ \{ID_{NA},\ T_{NA},\ RN_{NA},\ H(M_{NA})\} \tag{4}\]  
When a message is received from the \(NA\), \(GH_{i}\) checks the difference of time stamps (\(T_{NA}-T_{GH_{i}}\)) < \(\Delta\)t of the received message. In the case of an outdated message, the received message is discarded, and the resend request is shared with the \(NA\). Otherwise, the \(GH_{i}\) authenticates the \(Ni\) by comparing the hashes \(H(M_{Ni})\) and equals \(H(M_{NA})\) received from the \(Ni\) and \(NA\). In the case where both the hashes are matched, \(GH_{i}\) adds the \(Ni\) to the list of group members. Moreover, the \(GH_{i}\) stores the \(Ni\)'s information in the group table. Otherwise, the join request is failed as the user is not legitimate or an attacker. The feasible verified steps are shown in Algorithm 1. ```
1.\(Ni\rightarrow\textbf{{G}}_{\textbf{H}}\): \(EM_{Ni}=K_{G_{H}}\ \{ID_{Ni},\ T_{Ni},\ RN_{Ni},\ H(M_{Ni})\}\)
2.\(\textbf{{G}}_{\textbf{H}}\): If (\(T_{Ni}-T_{GH_{i}}\)) < \(\Delta\)t then
3.\(\textbf{{G}}_{\textbf{H}}\): \(\textbf{{G}}_{\textbf{H}}\)\(\rightarrow\) NA: \(EM_{GHi}=K_{N_{A}}\ \{ID_{GH_{i}},\ T_{GH_{i}},\ RN_{GH_{i}},\ Req\ (ID_{Ni})\}\)
4.\(NA\rightarrow\textbf{{G}}_{\textbf{H}}\): \(EM_{NA}=K_{G_{H}}\ \{ID_{NA},\ T_{NA},\ RN_{NA},\ H(M_{NA})\}\)
5.\(\textbf{{G}}_{\textbf{H}}\): If (\(T_{NA}-T_{GH_{i}}\)) < \(\Delta\)t then
6.\(\textbf{{G}}_{\textbf{H}}\): If (\(H_{Ni}\)) equals \(H(M_{NA})\) then
7. Add \(Ni\) in the group and store \(Ni\) data
8. Forward success message to \(Ni\) and \(NA\)
9. Else
10. Join request failed
11. End if
12. Else
13. Drop message and forward resent request of required data
14. End if
15. Else
16.