Skip to main content
. 2020 Feb 4;22(2):175. doi: 10.3390/e22020175
Algorithm 2 Image encryption.
  • Require:genesisblock(Gb)

  • Ensure:Image(P)

  •  Get m x n from P

  •  initialize y=uint8(zeros(mxn))

  •  initialize K = 1

  • sh=rand(1,512×512)

  • [t,Ind]=sort(sh);

  • while i ≤ m do

  •   while i ≤ n do

  •    temp=x(i,j:j+31);

  •    y(i,j:j+31)=(Gb(k,:)p(i,j:j+31));

  •    Gb(k+1,:)=uint8(sha256hasher.ComputeHash(y(i,j:j+31)));

  •    increment k by 1

  •   end while

  • end while