Skip to main content
. 2023 Jul 31;25(8):1147. doi: 10.3390/e25081147
Algorithm 3 Dynamic binary scrambling algorithm
  • Input: 

    The input image C(2), v(x) obtained in hash value stacking, and the key streams Q(3)(1,3) and Q(5)(1:2×N).

  •   1:

    Get the height M and width N of C(2);

  •   2:

    Set r(p)=((v(x)+Q(3)(1,2))modM/8)+M/2;

  •   3:

    Set C(3)NM×N;

  •   4:

    C(3)(1:r(p),:)=C(2)(Mr(p)+1:M,:)

  •   5:

    C(3)(r(p)+1:M,:)=C(2)(1:Mr(p),:)

  •   6:

    Set C(t)=C(3)(1:r(p),:);

  •   7:

    Sort Q(5)(1:N) to get the index vector R(x).

  •   8:

    for  i=1 to N do

  •   9:

       C(3)(1:r(p),R(x)(i))=C(t)(:,i);

  •  10:

    end for

  •  11:

    Set C(t)=C(3)(r(p)+1:M,:);

  •  12:

    Sort Q(5)(N+1:2×N) to get the index vector R(x).

  •  13:

    for  i=1 to N do

  •  14:

       C(3)(r(p)+1:M,R(x)(i))=C(t)(:,i);

  •  15:

    end for

  • Output: 

    The output image C(3).