01 January 2022 3 6K Report

Please help me to solve my problem in my code ......

I need to use S as index to change positions of matrix A

I need make permutation positions of elements of matrix by bellow substitute:

Substitute A(S(i) ) with A (S(M×N)−i+1).,where M and N is rows and cols of matrix

Here i = 1, 2,..., M × N/2

then I need reversible to obtain original matrix.

I write the code but I couldn't get the original matrix and I contacted with authors but no one response to me .

Note: this way for permutation from this paper: A novel plaintext-related image encryption scheme using hyper-chaotic system and the matrix is an image but for simplicity I implemented permutation on small matrix called A.

A =[111 222 30 4;50 65 70 83; 10 27 39 40 ; 54 67 72 81 ];% original matrix we need to shuffle

S=[1 11 1 4 3 14 6 11 13 11 7 15 5 9 9 7];% index used to shuffle matrix A

%{

Remove the repeated elements from matrix index S, and

then put the absent numbers at the end to generate a new sequence X.

%}

C = 1:numel(A);

S = unique(S,'stable');

S = [S C(~ismember(C,S))]

% start permutation

[row,col]=size(A);

len=row*col;

B=reshape(A,1,len);

A=B;

for i =1:len/2

A(S(i))=A(S(len-i+1));

end

Ab=reshape(A,row,col);

% To get original matrix :eversible to obtain original matrix but I couldn't get original matrix .

AA=reshape(Ab,1,len);

for i =1:len/2

AA(S(len-i+1))=AA(S(i));

end

Abb=reshape(AA,row,col);

@Peng Changgen this way for permutation from your paper: A novel plaintext-related image encryption scheme using hyper-chaotic system.

please explain to my what is my error.

@Fawad Masood can you help me?

More Arshub Saif's questions See All
Similar questions and discussions