Implement_RSA_inMatlab
How does this program work?
- Calculate the public and private keys
- Program will provide three example images with different pixels density, if user not choose any of the example picture, the program will choose a bench mark image.
- Once choose any of image, program will convert image to uint8 array.
- Random number will be added to each element of the image array
- Program will use the public key to encrypt the image
- Program will use the private key to decrypt the image
- The original, encrypted and decrypted image will be display in the output
When run the program, the parameters and keys are stated in below.
The p is 17 the q is 19
The x calculated is: 288
The e is: 13
The n calculated is: 323
Public key is: 323 13
The d calculated is: 133
Private key is: 323 133
Of course you can choose your own parameters.
The results of encryption and decryption is stated below.
The build in three example pictures for tests are stated below
Requirements and notice for running this code
This code only able to process greyscal images This code requires:
- vpi package Variable Precision Integer Arithmetic by John D'Errico https://uk.mathworks.com/matlabcentral/fileexchange/22725-variable-precision-integer-arithmetic
- Image processing toolbox
Notice:
- The running time may be at least 3 minutes, the parameters choosen above may result 7 minutes running time.
- This program is unable to process color pictures but grey level pictures only.
- The suggested parameters should smaller than the example given above, otherwise the encryptted picture may be pitch black.