Skip to main content
. 2021 Jun 24;21(13):4320. doi: 10.3390/s21134320
Algorithm 1: Encryption Algorithm
    Input : r1,,r6: pseudo-random sequences
    (t,x,y,p): an event
    M,N: the width and height of the NVS
    Output: (t,x,y,p): an encrypted event
  • 1

    y=(y+r1x)modN;

  • 2

    x=(x+r2y)modM;

  • 3

    y=(y+r3x)modN;

  • 4

    x=(x+r4y)modM;

  • 5

    r5=Sort(r5);

  • 6

    Generate Sr5 which maps the index of each element in the original sequence of r5 to the sorted r5;

  • 7

    ptemp=Sr5(pN+y)N;

  • 8

    y=Sr5(pN+y)modN;

  • 9

    r6=Sort(r6);

  • 10

    Generate Sr6 which maps the index of each element in the original sequence of r6 to the sorted r6;

  • 11

    p=Sr6(ptempM+x)M;

  • 12

    x=Sr6(ptempM+x)modM;