in a code of encryption if y=mod(x,256); is used. how can i apply the same statement in decryption process to get x back if i have only y and 256 know..
1 次查看(过去 30 天)
显示 更早的评论
采纳的回答
Jan
2016-1-2
编辑:Jan
2016-1-2
You can't. If x is smaller than 256, the modulo operation replies x without changes. If x is larger than 256, this operation replies the remainder of the division, and the other information is lost. So if you do not store the value of floor(x / 256) anywhere, this "encryption" is not reversable in a unique manner.
16 个评论
tania
2016-1-3
actually i was doing encryption by bit level permutation..which uses arnold cat map and logistic map..in the decryption process ..i applied all the processes in a reverse manner to get the intial image..is this encryption process not reversible?? can u tell me what is this encryption used for ..if it cannot be decrypted to get back the intial image.. thanks in advance
Image Analyst
2016-1-3
Only if you kept track of how many multiples of 256 your signal was sitting on top of.
Walter Roberson
2016-1-3
The arnold cat map is reversible in one step by using a lookup table.
Populate a cell array the same size as your original array, and fill the cell array with the coordinate pairs of the cell location. Apply the cat map process, moving the cell contents. The result is a lookup table for inversion: to know where location (I,J) came from, look in the table at location (I,J) and the cell content there give you the original coordinates.
tania
2016-1-24
编辑:tania
2016-1-24
i have basically done encryption by bit level permutation using logistic and arnold cat map.it is a article published in elsevier .i m struck in the decryption or we can say inverse of arnold cat map. as it loses the info. in the application of mod in it.Walter Roberson sir .. would u plzz make me understand the concept of cell array and cell location . as i m not able to get the above explaination.. moreover ..if i hv encrypted the image and sent it . at the other end the person only has the secret ket and decryption algo. the look table cannot be sent to the receiver. thanks
Walter Roberson
2016-1-24
Example:
[rows, cols] = size(YourArray);
[R, C] = ndgrid(1:rows, 1:cols);
map_cell = arrayfun(@(r,c) {r,c}, R, C, 'Uniform', 0);
Now map_cell is a cell array that has the same number of rows and columns as YourArray, and for any location YourArray(I,J), map_cell{I,J} = [I,J] which is the coordinates in the original array. Now you can apply the arnold cat map to map_cell, moving the cell contents around to get a new array, such as map_from_cell, which will be such that map_from_cell{I,J} will be the vector of coordinates that tell you where that location moved from .
This is something you can do on the decoding side, provided you know the size of the original array.
With the map_from_cell in hand, you can use
for J = 1 : size(map_from_cell,1)
for K = 1 : size(map_from_cell,2)
came_from = map_from_cell{J,K};
unscambled_image( came_from(1), came_from(2) ) = scambled_image(J,K);
end
end
tania
2016-2-3
how can i apply arnold cat map to a matrix containing cell arrays??? i tried doing so ..but it gives error
Undefined function 'mrdivide' for input arguments of type 'cell'.
Walter Roberson
2016-2-4
[rows, cols] = size(YourArray);
idximg = reshape(1:numel(YourArray), rows, cols);
Now apply the cat map to idximg producing cat_idximg .
Now,
unscambled_image = zeros(rows, cols, class(scrambled_image));
unscambled_image(cat_idximg) = scrambled_image;
Caution: you might have written your cat map code expecting the values to be uint8. Your cat map code should be written to produce an output image the same type as its input image, by initializing like I show above, using zeros and class()
tania
2016-2-4
编辑:Walter Roberson
2016-2-4
I=[2 3 4 ; 5 6 7; 7 8 9];
[rows, cols] = size(I);
[R, C] = find(I);
P1 = arrayfun(@(r,c) {r,c}, R, C, 'Uniform', 0);
id = reshape(1:numel(I), rows, cols);% index image
z=4;
KD(1)=0.34565487923280;%%arbitrary selected
yy1=mod(((z*(I/1000)*(1-I)/1000)*1000)+(KD(1)*10^10),256);
yy=mod(((z*(id/1000)*(1-id)/1000)*1000)+(KD(1)*10^10),256);
unscambled_image = zeros(rows, cols, class(yy1));
unscambled_image(yy) = yy1;
for J = 1 : size(yy,1)
for K = 1 : size(yy,2)
came_from = yy{J,K};
unscambled_image( came_from(1), came_from(2) ) = yy1(J,K);
end
end
basically i want to do all the procedure on a image .. but only for testing i applied on a matrix of 3x3.
my main aim is to retrieve the values of the matrix as it is. now this error is coming
Subscript indices must either be real positive integers or logicals.
Error in try11 (line 13)
unscambled_image(yy) = yy1;
as the value of
yy=[184.256000041962 184.111999988556 183.967999935150;
184.243999958038 184.064000129700 183.884000301361;
184.231999874115 184.016000270844 183.800000190735];
Walter Roberson
2016-2-4
I do not know where you got your code for KD and yy and yy1, but it is not correct code for an Arnold Cat Map. Arnod Cat Map uses strictly integer coefficients, as the output of a Cat Map step is a set of coordinates where you are to write the data into.
tania
2016-2-7
i got this from a review paper published in ELSEVIER in ScienceDirect..."A chaotic Based symmetric image encryption using bit level permutation. " in 2010 under information sciences. the encryption process is given.. i have problem in the decryption process, to retrieve the values back.
tania
2016-2-9
i think the pic given as attachment file will help u to understand.. it is of one of the page of the paper. which contains the main equation.
Walter Roberson
2016-2-9
That paper has an incorrect algorithm unless there is a non-standard notation that is explained earlier in the paper or unless there is a typesetting mistake in the formula. I would need a printed copy of the paper (based upon the original manuscript, not an image of it), and a magnifying glass to be certain, but with the image you have given the algorithm certainly appears to be wrong.
tania
2016-2-11
Sry for the inconvenience and thank u and I will try to provide the hard copy if possible
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Encryption / Cryptography 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)