RSA This algorithm is used in cryptography Technique in that RSA is added along with it. These are procedures followed
Key generation
RSA involves a public key and a private key. The public key can be known to everyone and is used for encrypting messages. Messages encrypted with the public key can only be decrypted using the private key. The keys for the RSA algorithm are generated the following way:
1. Choose two distinct prime numbers p and q.
* For security purposes, the integers p and q should be chosen uniformly at random and should be of similar bit-length. Prime integers can be efficiently found using a primality test.
2. Compute n = pq.
* n is used as the modulus for both the public and private keys
3. Compute φ(pq) = (p − 1)(q − 1). (φ is Euler's totient function).
4. Choose an integer e such that 1 < e < φ(pq), and e and φ(pq) share no divisors other than 1 (i.e., e and φ(pq) are coprime).
* e is released as the public key exponent.
* e having a short bit-length and small Hamming weight results in more efficient encryption. However, small values of e (such as e = 3) have been shown to be less secure in some settings.[4]
5. Determine d (using modular arithmetic) which satisfies the congruence relation d e \equiv 1\pmod{\varphi(pq)}.
* Stated differently, ed − 1 can be evenly divided by the totient (p − 1)(q − 1).
* This is often computed using the extended Euclidean algorithm.
* d is kept as the private key exponent.
The public key consists of the modulus n and the public (or encryption) exponent e. The private key consists of the private (or decryption) exponent d which must be kept secret.
Note:
* An alternative, used by PKCS#1, is to choose d matching e d ≡ 1 (mod λ) with λ = lcm(p-1,q-1), where lcm is the least common multiple. Using λ instead of φ(n) allows more choices for d. λ can also be defined using the Carmichael function λ(n).
* For efficiency the following values may be precomputed and stored as part of the private key:
o p and q: the primes from the key generation,
o d\mod (p - 1) and d\mod(q - 1),
o q^{-1} \mod(p).
[edit] Encryption
Alice transmits her public key (n,e) to Bob and keeps the private key secret. Bob then wishes to send message M to Alice.
He first turns M into an integer 0 < m < n by using an agreed-upon reversible protocol known as a padding scheme. He then computes the ciphertext c corresponding to:
c = m^e\,\bmod\,n
This can be done quickly using the method of exponentiation by squaring. Bob then transmits c to Alice.
[edit] Decryption
Alice can recover m from c by using her private key exponent d by the following computation:
m = c^d\,\bmod{\,n}.
Given m, she can recover the original message M by reversing the padding scheme.
(In practice, there are more efficient methods of calculating cd using the pre computed values above.)
[edit] A worked example
Here is an example of RSA encryption and decryption. The parameters used here are artificially small, but one can also use OpenSSL to generate and examine a real keypair.
1. Choose two prime numbers
p = 61 and q = 53 Make sure that these prime numbers are distinct.
2. Compute n = pq
n=61\cdot53=3233
3. Compute the totients of product. For primes the totient is maximal and equals the prime minus one. Therefore \varphi(pq) = (p-1)(q-1) \,
\varphi(61\cdot53) = (61 - 1)\cdot(53 - 1) = 3120\,
4. Choose any number e > 1 that is coprime to 3120. Choosing a prime number for e leaves you with a single check: that e is not a divisor of 3120.
e = 17
5. Compute d such that d e \equiv 1\pmod{\varphi(pq)}\, e.g., by computing the modular multiplicative inverse of e modulo \varphi(pq)\,:
d = 2753
since 17 · 2753 = 46801 and 46801 mod 3120 = 1, this is the correct answer.
(iterating finds (15 times 3120)+1 divided by 17 is 2753, an integer, whereas other values in place of 15 do not produce an integer. The extended euclidean algorithm finds the solution to Bézout's identity of 3120x2 + 17x-367=1, and -367 mod 3120 is 2753)
The public key is (n = 3233, e = 17). For a padded message m the encryption function is m^{17} \mod {3233} or abstractly:
c = m^e\mod {n}
The private key is (n = 3233, d = 2753). The decryption function is c^{2753} \mod {3233} or in its general form:
m = c^d\mod {n}
For instance, in order to encrypt m = 65, we calculate
c = 2790 = 65^{17}\mod {3233}
To decrypt c = 2790, we tap
m = 65 = 2790^{2753}\mod {3233}.
Both of these calculations can be computed efficiently using the square-and-multiply algorithm for modular exponentiation. In real life situations the primes selected would be much larger; in our example it would be relatively trivial to factor n, 3233, obtained from the freely available public key back to the primes p and q. Given e, also from the public key, we could then compute d and so acquire the private key.
These Procedures implemented in TCL coding to run in NS2 .For codings and queries please send the mail to admin.
Subscribe to:
Post Comments (Atom)
Hi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is shivprakasht@gmail.com
ReplyDeleteHi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is yahiatene.y@gmail.com
ReplyDeleteThank you very much
Hi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is prakash20031990@gmail.com
ReplyDeletethank u...:)
Dear friend i want RSA algorithm in Ns2 for my research work...can u help me
ReplyDeletemy id: sunda.pass@gmail.com
Hi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is
ReplyDeletersmanian1946@gmail.com
hello, can you provide ns2 coding for this algorithm..
ReplyDeletei would be really thankfull
rahuldagar89@gmail.com
hello!could u pls send me the code for this RSA algo in ns-2?it will really be very helpful in doing my thesis work... i shall be very thankful to u..
ReplyDeleteemail id is
sneha_mnc24@yahoo.co.in
thanks with regards
sneha
hello!could u pls send me the code for this RSA algo in ns-2?it will really be very helpful in doing my thesis work... i shall be very thankful to u..
ReplyDeleteemail id is
sneha_mnc24@yahoo.co.in
thanks with regards
sneha
Hi sure no probs pls can explain any criteria in that iam having in TCl
ReplyDeleteok..u can send me in tcl..i have to run it on ns-2..
ReplyDeletethanks with regards,
sneha
Please send me the .tcl file to my email id shiva1533@gmail.com
ReplyDeletePleas send the .tcl file.its very useful to learn ns2 for me.so send me the file to my mail id shiva1533@gmail.com
ReplyDeletecan u pls mail the tcl and the c coding?? it will be very helpful...
ReplyDeletemail id: barvind89@gmail.com
hi can u send me the tcl coding for rsa algorithm i need it for my project purpose...thanks..here is my mail id praveent08@yahoo.co.in
ReplyDeletehi. i too need the tcl fime for th same. can u pls forwarrd it to me as well.
ReplyDeletethanks in advance. my email id is - a23_soumya2004@yahoo.co.in
Hi soumya sure i will help
ReplyDeletehi, could you please give me the ns2 coding for rsa?
ReplyDeleteauthemax_07@yahoo.com
thanks a lot...
Hi Ba,
ReplyDeleteSure helps you Kindly say which RSA needed and give me the full requirements, RSA advanced versions had been reveled. Thanks
hi,
ReplyDeleteI need to do encryption/Dec. in AODV protocol. do u hav the code,pls send me at reena_dubey_2006@yahoo.co.in i'l be very thankful to u
Hi, could you provide me the code for RSA in ns-2 it would be very helpful for my training
ReplyDeletethanks
email is ahlam.awala@utt.fr
Hi, could you provide me the code for RSA in ns-2 it would be very helpful for my research
ReplyDeletethanks
email is maram_mhmd@yahoo.com
i really need a help i cannot develop the RSA algorithm in the tcl file can you please send them for me??
ReplyDeleteHi, could you provide me the code for RSA in ns-2 it would be very helpful for my research
ReplyDeletethanks
email is iefazaid@gmail.com
hello!could u pls send me the code for this RSA algo in ns-2?it will really be very helpful in doing my thesis work... i shall be very thankful to u..
ReplyDeleteemail id is sasikumar.j@pantechmail.com
hello!could u pls send me the code for this RSA algo in ns-2?it will really be very helpful in doing my thesis work
ReplyDeletemail id-matu76556@gmail.com
hi... i am willing to develop a security based project in ns2.... so,snd me the RSA based tcl code...my mail id is sasikumar.j@pantechmail.com....
ReplyDeletethanks in advance......
This comment has been removed by the author.
ReplyDeleteHi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is rasj.tamu@gmail.com
ReplyDeleteHi can you please send me the code for RSA in ns2.
ReplyDeleteplease mail to elshuba12@gmail.com
hi..I'am doing a project in ns2. so, could u pls send me the code for this RSA algo in ns-2.
ReplyDeletethanks in advance....
my_email : rajitha.danushka88@gmail.com
Hi can you please send me the code for RSA in ns2.
ReplyDeleteplease mail to nikhil.mawandia@gmail.com
Hi i'm doing a project based on security in networks so could you please send me the code for RSA in ns2 thanks in advance
ReplyDeleteplease mail it to gss2756@gmail.com
hi please send me the code for RSA in ns2 thanks in advance
ReplyDeleteplease mail to karthiky87@gmail.com
Dear sir,
ReplyDeletecode is ok. But how to use the code and what are the changes are needed in this implementation
thanks and regards,
M.Alex
Could you please mail this code at manisha_mehta_in@yahoo.com
ReplyDeleteThanks in advance,
Manisha.
Hi Could you please mail the code of RSA algo in ns-2 to vijaychandra.manai@gmail.com
ReplyDeleteThanks & regards
Vijaya
Could you please send me a copy of the NS2 RSA code?
ReplyDeletequinto0827 [at] hotmail dot com.
Thanks!
please send me a copy of the NS2 RSA code!
ReplyDeletentekriwal@gmail.com
Thanks
Could you please mail RSA code in ns-2 to supasj@gmail.com
ReplyDeleteMany thank for you help
Hi i'm doing a project based on security in networks so could you please send me the code for RSA in ns2 thanks in advance
ReplyDeleteplease mail it to ravindra.mehta3@gmail.com
hello!
ReplyDeletecould you please send me the code for this RSA algo in ns-2?
my email is phothar.99@gmail.com
thanks in advance
regards,
pho
Sir,
ReplyDeleteI need RSA algorithm implementation in NS2.. Please help me.. mail ID: saran.satvi@gmail.com
Thanx in advance.
hi sir..
ReplyDeletei need source code of RSA in ns2.
please help me sir. my id is ramucevvell@gmail.com
thanks in advance
hi sir,
ReplyDeletei need source code of RSA in ns2 can u plz mail me rajeshcodes@gmail.com
Hi sir,
ReplyDeleteThanks for ur post, can u plz mail me the code for the RSA. my mail id is kathirselvam91@gmail.com
hi plz send me the codes..
ReplyDeleteid:smriti2101@gmail.com
Hi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is kalyanipolagani@gmail.com
ReplyDeleteThis comment has been removed by the author.
Deletehi my friend
ReplyDeletecan i have your RSA code in NS2 ?
i need it for my research
thank you in advance
malaysia.timche@gmail.com
Hi i'm doing a project based on location proof updating system in WSN so could you please send me the code for RSA in ns2 thanks in advance
ReplyDeleteplease mail it to lp8394@gmail.com
Hi friend
ReplyDeletei m trying to perform RSA algorithm in ns2 ..kindly send me the tcl code ..
email : parthi_29@rocketmail.com
thank u in advance
hi,
ReplyDeleteim working on rsa algorithm implementation in ns2.it would be great if u cn help me by sending the tcl code
thank you.
manasagunda18@gmail.com
Hello sir!I am working on this RSA algorithm for my M.E project,Kindly send me the TCL code for RSA algorithm.
ReplyDeleteMy mail Id:art_18king@yahoo.co.in
Hi!
ReplyDeleteWe want to simulate wireless sensor network in ns-2 with RSA as authentication protocol in nodes and BS. can you give us some idea how to simulate such network and run rsa ?
Kindly email me with your reply asap at muhammadwaqararshad@gmail.com
Would be really kind of you thanks
hi..
ReplyDeleteim working on RSA algorithm in ns2.
could u plz send me the code for the same..
Ill be really thankful if u do that..
My mail id is emailme.mahak@gmail.com
sir i recieved ur mail.. i need 64 bit.. i want to implement it on aodv..
ReplyDeletethanks for the help..plz reply
i want RSA coding please send me my mail id is charanyaraman@gmail.com
ReplyDeleteThis comment has been removed by the author.
ReplyDeletea very good article...keep up the good work. Just sent an email requesting for the code. Thanks in advance.
ReplyDeletecan you provide the code.. article is fine.. good to follow
ReplyDeleteHello sir,
ReplyDeletei m trying to perform RSA algorithm in ns2 ..kindly send me the tcl code ..
email : geetha.balu25@gmail.com
thank u in advance
sir, i am trying to do key generation using ECC for security in wireless sensor networks. kindly send me the tcl code.
ReplyDeleteemail: ramyacse1993@gmail.com
dear sir,
ReplyDeleteI am planning to implement RSA in ns2 for my project. It would really useful, if you could send me the code. thanks and sorry for troubling you.
my mail id reachgopal87@gmail.com
regadrs,g
opal
hai,
ReplyDeletecould you please send me tcl code for rsa and digital signatures to rosebud.yalini@gmail.com
Hi
DeleteSure i can help you in RSA algorithm just mail me your requirement like how much key bit needed, any detection or prevention is needed so that can help in it Thanks
Sir kindly send me RSA-1024 code .ASAP.. it need it for my research work...
ReplyDeletemy email id ... star1star123456@gmail.com
Thanks in advance...
Hello sir..
ReplyDeletekindly send me RSA 512 bit digital signature ...ns-2 implementaion code ,,, this is going to very much help for me..
my email is,,,ashishpokiya010@gmail.com
need complete coding in ns2 with configuaration of rsa encyrption plz send me kindly urgent email id is contact_to_mehta@yahoo.co.in
ReplyDeletei need of rsa encrption coding in ns2 . please send to me .email id is sundar93mitian@gmail.com
ReplyDeleteHello sir,
ReplyDeletei m trying to perform RSA algorithm in ns2 ..kindly send me the tcl code ..my mail id:menavinyadav@gmail.com
Ekta Gupta
ReplyDeleteSir,
pls send me rsa.tcl file in ns2 on my mail
id: er.ekta1015@gmail.com
Sir,
ReplyDeleteI need tcl code for rsa algorithm'
my mail id:soniadevi37@gmail.com
Hi could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is contact_to_mehta@yahoo.co.in
ReplyDeletehello Sir kindly provide me this code..... mail me to rasagna.nov21@gmail.com
ReplyDeletehai sir,
ReplyDeleteplease send me tha rsa tcl code. it is very helpful for my ME project. sooryasanthi@gmail.com
Hi,
ReplyDeleteplease provide me the code for RSA in ns2.It would be helpful for my main project work.Please mail to sarika24786@gmail.com
Thanks & Regards
Sarika
i could you provide me the code for RSA in ns-2 it would be very helpful for my research work thanks email is justinnagy19@gmail.com
ReplyDeleteHi,
ReplyDeleteI want DES algorithm code in ns2 ,I couldn't understand how to apply any algorithm in ns2 also how to attach with our .tcl file, please explain me,,,
E_mail:- saylihivarkar@yahoo.in
I requried RSA and Des algo. code in NS2 (tcl file) . If ant body have than please send me at gauttam2008@gmail.com
ReplyDeletethanx
Hi nandan
DeleteHope you got required information if still help needed please let me know thanks
Hi can you please send me the code for RSA in ns2.
ReplyDeleteMy mail id: ramanmoorthy4@gmail.com
I requried RSA and Des algo. code in NS2 (tcl file) . If anybody have than please send me at anuj0072002@gmail.com
ReplyDeletehi, can you send me the code..vry urgent pls
ReplyDeletemy email revient.ode@gmail.com
thanks
HI Revient
DeleteThanks for comment can you please share me the details like key size 128 or 64 bit so that code can be shared thanks
HI please provide me the RSA code. please send it to me at ersimranpreet1@gmail.com
ReplyDeleteHI Sandhya
ReplyDeleteYes sure will send the mail pls can you share me the base paper and other details will send the code and let me know the key bit size and other stuff in detail in mail thanks
Hey could I have the code for the RSA algo please
ReplyDeleteHey could I have the code for the RSA algo please
ReplyDeleteHI
ReplyDeletePlease confirm the key bit and how do you want in tcl or c++
Please i need the tcl code
DeleteThis comment has been removed by a blog administrator.
ReplyDeleteHi
ReplyDeleteFor my project I need to simulate RSA in ns2, So could you please send the code to this email address. vjawahar30@gmail.com