Info

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

How to decrypt the cipher-text generated by RC4 stream cipher?

1 Ansicht (letzte 30 Tage)
Abdul Gaffar
Abdul Gaffar am 7 Apr. 2020
Geschlossen: Walter Roberson am 7 Apr. 2020
I am encrypting 'text' message using keystream generated by RC4 stream cipher. But while decrypting the ciphertext generated by RC4 cipher, I am not getting the exact plain-text. I have attached my code.
%% \***---*** Text Encryption & Decryption using 'RC4' stream cipher ***---***/ %%
plain_text = 'MatLab R2020a';
P = double(plain_text);
S = [123, 34, 255, 76, 89, 155, 53, 0, 3, 82, 19, 45, 76]; % Keystream generated by RC4
E = bitxor(S, P); % Encryption
cipher_text = char(E); % O/p in text form
disp(cipher_text);
%% ************* For Decryption; You need keystream S and cipher_text ***********
d_cipher_text = '6C 8ùR1b!-'; % cipher_text copied from 'Workspace'
dP = double(d_cipher_text);
dE = bitxor(S, dP); % Decryption
dec_text = char(dE); % O/p in text form
disp(dec_text);
%% Conclusion: plain_text and dec_text are not same!!

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