SlideShare une entreprise Scribd logo
1  sur  7
Télécharger pour lire hors ligne
RSA CODE REPORT
ABSTRACT
This report to document the RSA code
and how it works from encrypting
certain message to how to decrypt it
using general and private keys which
will be generated in the given code.
mohamed el saidy – 201400711
Under supervision:
Dr: Asharaf said
Eng: Mohamed Zidan
Discrete Math project
RSA(Rivest-Shamir-Adleman) Code Report
Abstract
This report to document the RSA code and how it works from encrypting certain message to how to
decrypt it using general and private keys which will be generated in the given code.
The sequence of the report will be as following (theory, RSA Algorithm, Matlap implementation, GUI
implementation, Challenges then recommendations).
Theory
Firstly, RSA is a cryptosystem for public-key encryption, and is widely used for securing sensitive data,
particularly when being sent over an insecure network such as the Internet.
RSA was first described in 1977 by Ron Rivest, Adi Shamir and Leonard Adleman of the Massachusetts
Institute of Technology. Public-key cryptography, also known as asymmetric cryptography, uses two
different but mathematically linked keys, one public and one private. The public key can be shared with
everyone, whereas the private key must be kept secret. In RSA cryptography, both the public and the
private keys can encrypt a message; the opposite key from the one used to encrypt a message is used to
decrypt it. This attribute is one reason why RSA has become the most widely used
asymmetric algorithm: It provides a method of assuring the confidentiality, integrity, authenticity and
non-reputability of electronic communications and data storage.
RSA derives its security from the difficulty of factoring large integers that are the product of two
large prime numbers. Multiplying these two numbers is easy, but determining the original prime
numbers from the total - factoring - is considered infeasible due to the time it would take even using
today’s super computers.
RSA Algorithm
The public and the private key-generation algorithm is the most complex part of RSA cryptography.
Two large prime numbers, p and q, are generated. A modulus n is calculated by multiplying p and q.
This number is used by both the public and private keys and provides the link between them. The public
key consists of the modulus n, and a public exponent, e as it's a prime number that is not too large.
The e figure doesn’t have to be a secretly selected prime number as the public key is shared with
everyone. The private key consists of the modulus n and the private exponent d, which is calculated
using the Extended Euclidean algorithm to find the multiplicative inverse with respect to the totient of n.
Matlap implementation
primegen.m
The first function which will be used to generate
the two large prime numbers.
Egen.m
This function to generate the e exponent
number in which (gcdf), implemented, is used
to assert that e is coprime with
m=(p-1)*(q-1).
Figure (1) prime generator function
Figure (2) e exponent generator function
This is the implementation code for the
gcdf.m function.
dgenf.m
This is the function which is used to generate d
which is used with n to decrypt the massage.
Figure (3) GCD function
Figure (4) d exponent generator function
encrypt.m
This function is used to convert certain
massage to the ciphered text(encrypted),
using e and n=p*q through this equation:
Me
mod n = C
(M: stand for massage and C: for ciphered
text)
decrypt.m
This function is used to the Ciphered text to
the original massage, using d and n=p*q
through this equation:
Cd
mod n = M
(M: stand for massage and C: for ciphered
text)
Figure (5) encryption function
Figure (6) decryption function
GUI implementation
The whole implemented functions have been used to create this simple GUI in Figure (7).
Figure (7) RSA GUI
Challenges
• Matlab has limited number of digits to store which in case of large numbers (ex..11 digits)
truncate the number which causes error in the process.
Recommendation
• Using language other than Matlab(ex.. C++) to create the project.
References
http://searchsecurity.techtarget.com/definition/RSA

Contenu connexe

Tendances

Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
Uday Meena
 

Tendances (20)

Presentation about RSA
Presentation about RSAPresentation about RSA
Presentation about RSA
 
RSA Algorithm
RSA AlgorithmRSA Algorithm
RSA Algorithm
 
The Diffie-Hellman Algorithm
The Diffie-Hellman AlgorithmThe Diffie-Hellman Algorithm
The Diffie-Hellman Algorithm
 
Data Encryption Standard (DES)
Data Encryption Standard (DES)Data Encryption Standard (DES)
Data Encryption Standard (DES)
 
Public Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithmPublic Key Cryptography and RSA algorithm
Public Key Cryptography and RSA algorithm
 
Diffie-hellman algorithm
Diffie-hellman algorithmDiffie-hellman algorithm
Diffie-hellman algorithm
 
RSA Algorithm - Public Key Cryptography
RSA Algorithm - Public Key CryptographyRSA Algorithm - Public Key Cryptography
RSA Algorithm - Public Key Cryptography
 
RSA Algorithm
RSA AlgorithmRSA Algorithm
RSA Algorithm
 
rsa-1
rsa-1rsa-1
rsa-1
 
Pretty good privacy
Pretty good privacyPretty good privacy
Pretty good privacy
 
Network security cryptographic hash function
Network security  cryptographic hash functionNetwork security  cryptographic hash function
Network security cryptographic hash function
 
Pgp pretty good privacy
Pgp pretty good privacyPgp pretty good privacy
Pgp pretty good privacy
 
Diffie hellman key exchange algorithm
Diffie hellman key exchange algorithmDiffie hellman key exchange algorithm
Diffie hellman key exchange algorithm
 
Image and text Encryption using RSA algorithm in java
Image and text Encryption using RSA algorithm in java  Image and text Encryption using RSA algorithm in java
Image and text Encryption using RSA algorithm in java
 
3 public key cryptography
3 public key cryptography3 public key cryptography
3 public key cryptography
 
Cryptography.ppt
Cryptography.pptCryptography.ppt
Cryptography.ppt
 
Cryptography
CryptographyCryptography
Cryptography
 
S/MIME
S/MIMES/MIME
S/MIME
 
DES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentationDES (Data Encryption Standard) pressentation
DES (Data Encryption Standard) pressentation
 
Cs8792 cns - unit i
Cs8792   cns - unit iCs8792   cns - unit i
Cs8792 cns - unit i
 

Similaire à RSA Algorithm report

A comparative analysis of the possible attacks on rsa cryptosystem
A comparative analysis of the possible attacks on rsa cryptosystemA comparative analysis of the possible attacks on rsa cryptosystem
A comparative analysis of the possible attacks on rsa cryptosystem
IAEME Publication
 

Similaire à RSA Algorithm report (20)

Rsa Crptosystem
Rsa CrptosystemRsa Crptosystem
Rsa Crptosystem
 
Analysis of rsa algorithm using gpu
Analysis of rsa algorithm using gpuAnalysis of rsa algorithm using gpu
Analysis of rsa algorithm using gpu
 
ANALYSIS OF RSA ALGORITHM USING GPU PROGRAMMING
ANALYSIS OF RSA ALGORITHM USING GPU PROGRAMMINGANALYSIS OF RSA ALGORITHM USING GPU PROGRAMMING
ANALYSIS OF RSA ALGORITHM USING GPU PROGRAMMING
 
CRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdfCRYPTOGRAPHY (2).pdf
CRYPTOGRAPHY (2).pdf
 
Enhanced RSA Cryptosystem based on Multiplicity of Public and Private Keys
Enhanced RSA Cryptosystem based on Multiplicity of Public and Private Keys Enhanced RSA Cryptosystem based on Multiplicity of Public and Private Keys
Enhanced RSA Cryptosystem based on Multiplicity of Public and Private Keys
 
Cryptosystem An Implementation of RSA Using Verilog
Cryptosystem An Implementation of RSA Using VerilogCryptosystem An Implementation of RSA Using Verilog
Cryptosystem An Implementation of RSA Using Verilog
 
RSA Algorithem and information about rsa
RSA Algorithem and information about rsaRSA Algorithem and information about rsa
RSA Algorithem and information about rsa
 
F010243136
F010243136F010243136
F010243136
 
PUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.pptPUBLIC KEY & RSA.ppt
PUBLIC KEY & RSA.ppt
 
Research on RSA
Research on RSAResearch on RSA
Research on RSA
 
RSA - ENCRYPTION ALGORITHM CRYPTOGRAPHY
RSA - ENCRYPTION ALGORITHM CRYPTOGRAPHYRSA - ENCRYPTION ALGORITHM CRYPTOGRAPHY
RSA - ENCRYPTION ALGORITHM CRYPTOGRAPHY
 
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptxRivest Shamir Adleman Algorithm and its variant : DRSA.pptx
Rivest Shamir Adleman Algorithm and its variant : DRSA.pptx
 
Presentation
PresentationPresentation
Presentation
 
An implementation of RSA policy
An implementation of RSA policyAn implementation of RSA policy
An implementation of RSA policy
 
Ijetcas14 336
Ijetcas14 336Ijetcas14 336
Ijetcas14 336
 
State of the art parallel approaches for
State of the art parallel approaches forState of the art parallel approaches for
State of the art parallel approaches for
 
Data Security With Colors Using Rsa
Data Security With Colors Using RsaData Security With Colors Using Rsa
Data Security With Colors Using Rsa
 
Performance evaluation of modified modular exponentiation for rsa algorithm
Performance evaluation of modified modular exponentiation for rsa algorithmPerformance evaluation of modified modular exponentiation for rsa algorithm
Performance evaluation of modified modular exponentiation for rsa algorithm
 
Rsa
RsaRsa
Rsa
 
A comparative analysis of the possible attacks on rsa cryptosystem
A comparative analysis of the possible attacks on rsa cryptosystemA comparative analysis of the possible attacks on rsa cryptosystem
A comparative analysis of the possible attacks on rsa cryptosystem
 

Dernier

The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Dernier (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

RSA Algorithm report

  • 1. RSA CODE REPORT ABSTRACT This report to document the RSA code and how it works from encrypting certain message to how to decrypt it using general and private keys which will be generated in the given code. mohamed el saidy – 201400711 Under supervision: Dr: Asharaf said Eng: Mohamed Zidan Discrete Math project
  • 2. RSA(Rivest-Shamir-Adleman) Code Report Abstract This report to document the RSA code and how it works from encrypting certain message to how to decrypt it using general and private keys which will be generated in the given code. The sequence of the report will be as following (theory, RSA Algorithm, Matlap implementation, GUI implementation, Challenges then recommendations). Theory Firstly, RSA is a cryptosystem for public-key encryption, and is widely used for securing sensitive data, particularly when being sent over an insecure network such as the Internet. RSA was first described in 1977 by Ron Rivest, Adi Shamir and Leonard Adleman of the Massachusetts Institute of Technology. Public-key cryptography, also known as asymmetric cryptography, uses two different but mathematically linked keys, one public and one private. The public key can be shared with everyone, whereas the private key must be kept secret. In RSA cryptography, both the public and the private keys can encrypt a message; the opposite key from the one used to encrypt a message is used to decrypt it. This attribute is one reason why RSA has become the most widely used asymmetric algorithm: It provides a method of assuring the confidentiality, integrity, authenticity and non-reputability of electronic communications and data storage. RSA derives its security from the difficulty of factoring large integers that are the product of two large prime numbers. Multiplying these two numbers is easy, but determining the original prime numbers from the total - factoring - is considered infeasible due to the time it would take even using today’s super computers. RSA Algorithm The public and the private key-generation algorithm is the most complex part of RSA cryptography. Two large prime numbers, p and q, are generated. A modulus n is calculated by multiplying p and q. This number is used by both the public and private keys and provides the link between them. The public key consists of the modulus n, and a public exponent, e as it's a prime number that is not too large. The e figure doesn’t have to be a secretly selected prime number as the public key is shared with everyone. The private key consists of the modulus n and the private exponent d, which is calculated using the Extended Euclidean algorithm to find the multiplicative inverse with respect to the totient of n.
  • 3. Matlap implementation primegen.m The first function which will be used to generate the two large prime numbers. Egen.m This function to generate the e exponent number in which (gcdf), implemented, is used to assert that e is coprime with m=(p-1)*(q-1). Figure (1) prime generator function Figure (2) e exponent generator function
  • 4. This is the implementation code for the gcdf.m function. dgenf.m This is the function which is used to generate d which is used with n to decrypt the massage. Figure (3) GCD function Figure (4) d exponent generator function
  • 5. encrypt.m This function is used to convert certain massage to the ciphered text(encrypted), using e and n=p*q through this equation: Me mod n = C (M: stand for massage and C: for ciphered text) decrypt.m This function is used to the Ciphered text to the original massage, using d and n=p*q through this equation: Cd mod n = M (M: stand for massage and C: for ciphered text) Figure (5) encryption function Figure (6) decryption function
  • 6. GUI implementation The whole implemented functions have been used to create this simple GUI in Figure (7). Figure (7) RSA GUI
  • 7. Challenges • Matlab has limited number of digits to store which in case of large numbers (ex..11 digits) truncate the number which causes error in the process. Recommendation • Using language other than Matlab(ex.. C++) to create the project. References http://searchsecurity.techtarget.com/definition/RSA