Research Article

A Novel Chaotic Image Encryption Algorithm Based on Latin Square and Random Shift

Algorithm 2

Latin square substitution Pr = Replace (P, (i, j), Lr, Ltable).
Input: Plain image P, Lc, Lr, and Ltable.
Output: Image Pr after pixel replacement.
for i = 0 : 1: N−1 do
  for j = 0:1: N−1 do
      Pr (i, j) = Ltable ( (i, j), Lr (i, j))
  end
end
where bitget (P, i) (i = 1, 2, …, 8) represents obtaining the ith bit plane of the plain image P.