File Exchange

image thumbnail

RSA algorithm

version 1.1 (1.47 KB) by

RSA algorithm for encrypting and decrypting a message



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.

Comments and Ratings (5)

Tim Kaufmann

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

Undefined function or variable

Antonio Afta

khurria zafar


rh (view profile)

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



Updating code to work for even small prime numbers


changed the title to RSA algorithm

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video