#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to apply symmetric cryptography in ns2?

Description

Message from the source to destination is sent in encrypted form. Input message is encrypted using the symmetric key and it is decrypted at the receiver using the same key. Encryption and decryption follows the symmetric cryptography algorithm.

Sample Code

#Filename: symmetric_Crypto.cc

Encryption() {

int key =brokey;
int i=0;
for (i=0;i<strlen(out);i++)
{
out[i]=(out[i]+key)%128;
}

Decryption () {
int key =brokey;
int i=0;
for (i=0;i<strlen(out);i++)
{
out[i]=(out[i]-key)%128;
}

data=out;

 


Screenshots