Is image type show any difference in calculating the time to encrypt or decrypt or encrypt and decrypt the image?

2 次查看(过去 30 天)
Is image type show any difference in calculating the time to encrypt or decrypt or encrypt and decrypt the image? I am calculating the time complexity to encrypt and decrypt lena image of 5 types (lena.tif,lena.jpg,lena.png, lena.bmp, lena.gif)

回答(2 个)

Walter Roberson
Walter Roberson 2016-5-6
The time to decrypt an array is independent of how the array was derived, unless the "encryption" depends in subtle ways on the content of the image and the "information content" of some of the versions is different (e.g., JPEG probably has less information than the others.)
If you read in a JPEG lossy image, encrypt it, and write it out again as JPEG lossy, then do not be surprised if you cannot decrypt it properly afterwards.
  7 个评论
Walter Roberson
Walter Roberson 2017-10-24
编辑:Image Analyst 2017-10-24
Do I understand correctly that you have something like,
impng = imresize( imread('lena.png'), [128 128]);
imtif = imresize( imread('lena.tif'), [128 128]);
imjpg = imresize( imread('lena.jpg'), [128 128]));
imbmp = imresize( imread('lena.bmp'), [128 128]));
and that then after that if you pass the results through the two different encryption methods, that they take different amounts of time, that can repeatably vary up to a full minute in timings?
Have you tried executing them in a random order to determine whether you might be getting some kind of order effect (sometimes the first time running code can be much slower)?

请先登录,再进行评论。


Image Analyst
Image Analyst 2016-5-7
I think you probably meant to use the word encoding and decoding rather than encrypting and decrypting. Saving a file encoded as PNG is an entirely different thing than taking an image array and encrypting it. Encoding uses a well described protocol and does not need any password or passkey or anything like that. So if you encode according to the BMP format for example, anyone can decode it because it is not encrypted.
Yes there will be slight differences because they use different formats, and some take time to compress the data while others don't. However the ones that compress take less time to save to disk that may or may not save more time than the excess time spent compressing. You just have to try it and see for different sized images. Do it over a big size range, like ten to one or so.

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by