Table 1 Pseudo-code for the PPHSFL algorithm.

From: Based on model randomization and adaptive defense for federated learning schemes

PPHSFL Algorithm: A Privacy-Preserving and High-Secure FL

Initialize: Datasets, \({{w_g}}\), \(\gamma\), k=0, d, R

while \(t \le \tau\) :

   for \(k \le \gamma -1\), \({w_g}(t) \leftarrow WgtAvg\,\{ {R^*},{\omega _i}(t)\}\)

   if \(k = \gamma -1\) :then

      Randomly generate K, obtained \({G_\gamma }\)

      Get the K-skips step sequence \(G_{\gamma ,k} \leftarrow G(\gamma )\)

      Obtained \({G_\gamma }(s_i)\) and get compensation \({G_c\gamma }({s_i})\)

      Calculate \({\omega _n}(t)\) and delete \({G_\gamma }[0]\)

   upload \({\omega _n}(t)\)

   for \(i < n\) do:

   Calculate \(a_t^i = {1 / {(1 + \exp ({P_i}(t)))}}\)

   Randomly generate d subsets \(C_d\)

   for \(i < d\) do

   Calculate \({A_d}(t)\) and Sort \({A_d}(t)\)

   Select \(max({{A_d(t)}})\) and Calculate \({R_n}(t)\)

   Update R, Calculate \({R_n}(t)\) and \(R^*\)

   \({w_g}(t) \leftarrow WgtAvg\,\{ {R^*},{\omega _i}(t)\}\)

if \(t = \tau\) :break

return: Global model \({w}_{g}\).