## 4 Prevention Mechanisms of the Proposed Scheme
### Proposed Scheme System Architecture Model (PSAM)
The algorithm is based upon the variation in frequency, position, and velocity. Algorithm 1 is used for the detection of attacked packets. ```
1 function RECOGNIZE (attacked packet for HDSA in the models). 2 Start
3 Discover \(F=\lambda^{*}\left|V-\frac{v_{max}}{2}\right|\)
4 If (\(F\geq\) high && \(V\geq\) high) then
5 recognize (Attacked packet)
6 set attacked packet detection Alg (req) then
7 Start when validated (request)
8 return true
9 else
10 if (\(F\leq\) low && \(V\leq\) low) then
11 return invalid request
12 else
13 set attacked packet detection Alg (req)
14 endif
15 endif
16 end if
17 end if
```  
**Algorithm 1**Detection of all attacked packets based on hybrid DoS attacks (HDSA) and other attacked packets in the HDSA model (HDAM). The above algorithm can be applied prior to the verification time and to increase the security. The algorithm is utilized for detection of unacceptable requests with the attacked packet. It can also be utilized to avoid the end-to-end delay CO on the path of vehicles in the network. It is also worth noting that establishment of a safe and secure root is another matter, and sending the data in secure manner is also another matter. Even if the roots are safe, they cannot be 100% trusted. The proposed scheme model utilizes a Vehicular RSA algorithm (VRA) type at the transmitter end. The transmitting node also shares a key to the universal port (a port that keeps an eye on data sharing and vehicle information), which is established at the center of the network. The receiving node has the same key, which is shared by the transmitting node, but obviously there must be an intermediator who can verify it. The central port plays the role of the intermediator. The receiving node and the transmitting node both send their key with the added registration number of the vehicle to the central port. Suppose the key is 6612 and the registration number of the transmitter is 31, then the shared key will be \(6612+31=6643\). The receiver will also show 6612, and assuming that the registration number of the receiver is 45, then the key which is shared by the receiver will be \(6612+45=6657\). The central port subtracts the registration number from both the sender and transmitter shared value. If after the subtraction both share the same common key, the decryption key is shared by the central port. The vehicular RSA encryption algorithm used at the transmitter end to further secure the network given as Algorithm 2. ```
1 ifSender vehicle \(S_{v}\) creates a key then
2 receiver vehicle \(R_{v}\) and \(S_{v}\) creates two large prime numbers (\(P\) and \(Q\)) then/note that \(P\) and \(Q\) are each about same number of digits long, and are selected such that their product is long
3 set \(S_{v}\) and \(R_{v}\) to determine the value of large number \(N\) using, \(N=PQ\)then
4\(R_{v}\) and \(S_{v}\) Creates the value \(M\)/using the given expression below, Euclidean algorithm
5\(M=\) phi (\(N\)) = \((P-1)\) (\(Q-1\))
6 if\(S_{v}\) and \(R_{v}\) select any integer value \(E\)then
7\(E=\) positive integer/\(E\) lies between, \(0<E<M\)
8 function GCD (\(M\), \(E\)) = 1//(GCD is Greater Common Divisor)
9\(S_{v}\) and \(R_{v}\) calculate the value of \(D\)
Output: The quotient and remainder of \(M\) and \(E\)
10 If\((E\times D)=1\) (mod \(M\))then
11\((E\times D)\) mod \(M=1\) &
12
13 if\(S_{v}\) and \(R_{v}\) create the Public key: \(E\), \(N\)then
14 set \(S_{v}\) and \(R_{v}\) to create Private Key using \(D\) and \(N\) Encryption/Verification:
15 if\(S_{v}\) and \(R_{v}\) can utilize original plain text (a block value) = \(X\)... \(X<N\)then
16\(S_{v}\) and \(R_{v}\) obtain Ciphertext = \(C\)... \(C=(X^{E})\) mod \(N\)
17 endif
18 Decryption/Signing:
19 if\(S_{v}\) and \(R_{v}\) Utilize Ciphertext = Cthen
20\(S_{v}\) and \(R_{v}\) utilizes Deciphertext = Y
216 endif
22
23 endif
24
25 endif
```  
**Algorithm 2** Vehicular RSA Encryption Algorithm. The proposed vehicular RSA is an algorithm used by modern fog computing and cloud-based techniques to encrypt and decrypt packet data during the data transmission.