Research Article
A Random Label and Lightweight Hash-Based Security Authentication Mechanism for a UAV Swarm
Algorithm 1
The encryption algorithm of RC4.
| 1: Generate key stream seed 1: | | 2: Given a state vector S, initialize it, and assign 0, 1, 2, ..., 254, 255 to each byte in ascending order; | | 3: fordo | | 4: ; | | 5: end for | | 6: Enter the initial key: | | 7: The initial key is defined as any combination of less than 256 bytes; | | 8: Fill in circularly until 256 bytes are filled; | | 9: The final result is defined as a vector T, which is used to generate seed 2; | | 10: Disrupt the initial seed 1: | | 11: Perform a replacement operation on the state vector S, starting from the 0th byte, and executing 256 times to ensure that each byte is processed; | | 12: ; | | 13: fordo | | 14: ; | | 15: ; | | 16: end for | | 17: Generate key stream and encrypt: | | 18: ; | | 19: while clabel.length– do | | 20: ; | | 21: ; | | 22: ; | | 23: ; | | 24: ; | | 25: ; | | 26: end while |
|