File Exchange

image thumbnail

RSA algorithm

version 1.1.0.0 (1.47 KB) by suriyanath
RSA algorithm for encrypting and decrypting a message

35 Downloads

Updated 17 Sep 2016

View License

This code asks for Two prime numbers and then computes Public and Private key. Then the message is encrypted using Public key and decrypted using Private key. An example is shown in figure.

Cite As

suriyanath (2020). RSA algorithm (https://www.mathworks.com/matlabcentral/fileexchange/46824-rsa-algorithm), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

wang

No funciona. same to me.
Error in rsa_code (line 15)
e=randi(1,1,[2 n1]);

No funciona.

Error in rsa_code (line 15)
e=randi(1,1,[2 n1]);

Islam Adam

Ugwulayinka

How do I use this code to encrypt files?

fang zheng

thank you..

missing a function, is this in an additional toolbox or base matlab is ok.
I'm using 2015b.

Undefined function or variable
'randint'.

rh

you should use extended eucleudianalgorithm to search for d.
this implementation is incorrect
dec(enc(msg)) != msg

Updates

1.1.0.0

Updating code to work for even small prime numbers

1.1.0.0

changed the title to RSA algorithm

MATLAB Release Compatibility
Created with R2010b
Compatible with any release
Platform Compatibility
Windows macOS Linux