Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Can rc4 encryption applied for color images?

1 Ansicht (letzte 30 Tage)
Anushka
Anushka am 4 Aug. 2015
Geschlossen: Walter Roberson am 23 Jul. 2018
The following code for rc4 encryption and decryption for grayscale images.Can this be also used for color images?
function EI = endecryptImage(I, key)
keylength = length(key);
[m p] = size(I);
S = 0:255;
j = 1;
for i = 1:256
j = 1 + mod(j + S(i) + key(1 + mod(i, keylength)), 256);
tmp = S(i);
S(i) = S(j);
S(j) = tmp; %swap(S(i), S(j))
end
i = 1;
j = 1;
n = numel(I);
EI = zeros(1, n); % or EI = zeros(m, p), this enable us to avoid reshaping result
for k = 1:n
i = 1 + mod(i + 1, 256);
j = 1 + mod(j + S(i), 256);
tmp = S(i);
S(i) = S(j);
S(j) = tmp; %swap(S(i), S(j))
Ks = 1 + mod(S(i) + S(j), 256);
EI(k) = bitxor(S(Ks), I(k));
end
EI = reshape(EI, m, p);
  1 Kommentar
Shahryar Toughi
Shahryar Toughi am 5 Jun. 2017
It can be applied to bit planes of a color image. (it has several security hole)

Antworten (0)

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by