View full-text article in PMC Entropy (Basel). 2020 Feb 4;22(2):175. doi: 10.3390/e22020175 Search in PMC Search in PubMed View in NLM Catalog Add to search Copyright and License information © 2020 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/). PMC Copyright notice 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