- Beranda
- Komunitas
- Tech
- Programmer Forum
[ask matlab] Cara misahin rumus jadi dua form


TS
dunktek
[ask matlab] Cara misahin rumus jadi dua form
gan , misi ane mau tanya. ane dapet coding dari mathlabnya nih di forum .
clc;
disp('Implementation of RSA Algorithm');
clear all; close all;
p = input('\nEnter the value of p: ');
q = input('\nEnter the value of q: ');
[Pk,Phi,d,e] = intialize(p,q);
M = input('\nEnter the message: ','s');
x=length(M);
c=0;
for j= 1:x
for i=0:122
if strcmp(M(j),char(i))
c(j)=i;
end
end
end
disp('ASCII Code of the entered Message:');
disp(c);
% % %Encryption
for j= 1:x
cipher(j)= crypt(c(j),Pk,e);
end
disp('Cipher Text of the entered Message:');
disp(cipher);
% % %Decryption
for j= 1:x
message(j)= crypt(cipher(j),Pk,d);
end
disp('Decrypted ASCII of Message:');
disp(message);
disp(['Decrypted Message is: ' message]);
nah, rumus diatas pengen di pisah antara decripsi sama enkripsi, itu kayak gimana caranya yak, soalnya ane nyoba cuma di hapus fungsi enkripsi misalnya di form dekripsi. nah yang ke dekripsi teks nya laen lagi sama yang di enkripsi .
mohon bantuan para suhu disini
terima kasih
clc;
disp('Implementation of RSA Algorithm');
clear all; close all;
p = input('\nEnter the value of p: ');
q = input('\nEnter the value of q: ');
[Pk,Phi,d,e] = intialize(p,q);
M = input('\nEnter the message: ','s');
x=length(M);
c=0;
for j= 1:x
for i=0:122
if strcmp(M(j),char(i))
c(j)=i;
end
end
end
disp('ASCII Code of the entered Message:');
disp(c);
% % %Encryption
for j= 1:x
cipher(j)= crypt(c(j),Pk,e);
end
disp('Cipher Text of the entered Message:');
disp(cipher);
% % %Decryption
for j= 1:x
message(j)= crypt(cipher(j),Pk,d);
end
disp('Decrypted ASCII of Message:');
disp(message);
disp(['Decrypted Message is: ' message]);
nah, rumus diatas pengen di pisah antara decripsi sama enkripsi, itu kayak gimana caranya yak, soalnya ane nyoba cuma di hapus fungsi enkripsi misalnya di form dekripsi. nah yang ke dekripsi teks nya laen lagi sama yang di enkripsi .
mohon bantuan para suhu disini
terima kasih
0
451
0


Komentar yang asik ya


Komentar yang asik ya
Komunitas Pilihan