# Tokens Shuffling Approach for Privacy, Security, and Reliability in IoHT under a Pandemic
## 3 Proposed Approach (TSA)
### Algorithm of TSA  
Proposed Alogrithm of TSA was shown as following Alogrithm 1:  
``` Begin  For (i = 0; i < LocalCache.Items.Count; i++)  TimeSpan = Date1--LocalCache.Items[i].Date;  If (TimeSpan.Days > 14 )  LocalCache.Items[i].Remove();  else  Break;  End If  LocalCache.Items.Add(Location1, Po1, Date1, Time1);  Return true; End Function Function Tokens CheckStatus (UserID) Begin  Tokens = null;  If (ServerProvider1.check(UserID) == True) // infected  T1 = GenerateToken1 (UserID, CurrentDateTime); // Random and Unique Token  T2 = GenerateToken1 (UserID, CurrentDateTime); // Random and Unique Token  Send (T1, ServerProvider2);  Broadcast (T2, FogNodes);  Tokens.Add(T1);  Tokens.Add(T2); End If Return Tokens; // Note tokens will be valid for 1 day only. ## 4 Simulation and Results

In this section, we compare the proposed work with the four most common and basic approaches to privacy and security: Dummy enhance-CaDSA [31], obfuscation (DOA) [30], BTP [33], and collaboration (SPF) [37]. We selected a recent scientific paper for each approach. It was mentioned in the previous sections that these methods will not be suitable in times of pandemics because they have a negative impact on data accuracy, as in Dummy and DOA, or have overload, as in BTP and SPF. We will focus only on the comparison according to standard criteria or metrics in the evaluation of the different methods of protection. ### Metrics and Hypotheses

There are measures related to the level of privacy, the most famous of which are Entropy, K-Anonymity, and Estimated Error, and on the other hand, there are measures related to performance, the most important of which are the Number of Sent Queries, Size of the Sent Data or Results, Need for Pre-Processing or Post-Processing Data, and Ratio of Utilizing the Cache. All of the previous metrics can be measured or calculated, so they are considered quantitative metrics. There are also non-quantitative metrics, such as \"Does the protection method affect the accuracy of the main service and its results?\", \"Does the protection method need to trust a particular party such as a Peer, Fog, or SP?\", and, finally, \"Does the method of protection protect data security as well as privacy?\" Generally, quantitative measures can be calculated through the following equations [25; 38]:* K-Anonymity: it refers to the percentage of queries that belong to the user out of all the queries he sent to the service provider. Whenever this value approaches zero, this means better protection. \[\text{K}-\text{Anonymity}=\frac{1}{1+\text{k}}\] (1) where K is several dummies of fake queries. * Entropy (E): it refers to the amount of valid data that an attacker can collect about a user, i.e., that the attacker is sure that queries belong to a particular user. Usually, the value of E is between 0 and 1, where, in our example, 1 represents absolute uncertainty (the highest privacy protection) and 0 represents no protection, and the following equation calculates the entropy: \[\text{E}=-\sum_{i=0}^{\text{k}}\text{Pi}*\text{Log2}(\text{Pi})\] (2) where Pi is the probability that query (i) belongs to a selected user. Max (E) = 1 means the best protection for privacy, where the attacker does not have the right information about any user. * Estimate Error (EE): it indicates the percentage of false guesses that an attacker can fall on about user data and is usually calculated after calculating the entropy with the following equation: \[\text{EE}=\text{E}*100\%\] (3)
* The performance rate is related to the number of queries sent and is represented by the total number in Nq. * The performance rate relates to the amount of data sent, the total is represented by S, and the data volume for a single query will be represented by Sq. * The performance rate relating to the total time T is given by calculating the time of sending the user's queries to the SP and the time of processing.