Research Article

A Random Label and Lightweight Hash-Based Security Authentication Mechanism for a UAV Swarm

Algorithm 2

The iterative algorithm of SHA-256.
1: fordo
2: Logical function operation:
3: S0 = (A rightrotate 2)(A rightrotate 13)(a rightrotate 22);
4: Ma = (A and B)(A and C)(B and C);
5: t2 = S0 + Ma;
6: S1 = (E rightrotate 6)(E rightrotate 11)(E rightrotate 25);
7: Ch = (E and F)((not E) and G);
8: ;
9: Update each word:
10: H=G;
11: G=F;
12: F=E;
13: E = D + t1;
14: D = C;
15: C = B;
16: B = A;
17: A = t1 + t2;
18: Add the hash output of the message block to the existing hash output:
19: h0 = h0 + A;
20: h1 = h1 + B;
21: h2 = h2 + C;
22: h3 = h3 + D;
23: h4 = h4 + E;
24: h5 = h5 + F;
25: h6 = h6 + G;
26: h7 = h7 + H;
27: Output the final hash value (big-endian):
28: digest = hash = h0 append h1 append h2 append h3 append h4 append h5 append h6 append h7;
29:end for
30: return digest;