function myRSA (str,p,q,e)
n=p*q
d=inversemodulo(e,eulerphi(n)),
len=length(str)
M=zeros(1,len)
C=zeros(1,len)
D=zeros(1,len)
M=ascii(str),
disp('ASCII code of the entered message:');
disp(M)
for j=1:len
C(j)=powermod(M(j),e,n);
end
disp('Cipher Text of entered Msg:');
disp(C);
for j=1:len
D(j)=powermod(C(j),d,n);
end
disp('Decrypted Cipher Text of entered Msg:')
disp(D);
disp(["Decrypted Text:",char(D)])
endfunction