How to perform node authentication using elliptic curve cryptography in NS2

Description

Node authentication is required in network for like secure route discovery and data transmission. In such cases, node attaches the encrypted identity as the signature in the packet. Elliptic Curve Cryptography (ECC) an asymmetric cryptography technique is used for encryption and decryption.

C++ part :
// Encryption
ec_t::Point Pa = aa*G; // Source public key
ec_t::Point Pb = bb*G; // Receiver public key
ec_t::Point Pk = aa*Pb;
ec_t::ffe_t c1( m1*Pk.x());
ec_t::ffe_t c2( m2*Pk.y());

// Decryption
Pk = bb*Pa;
ec_t::ffe_t m1d = c1/Pk.x();
ec_t::ffe_t m2d = c2/Pk.y();

Sender=12 Receiver=1
Hash value of sender node=100
Hash value of receiver node=0
Sender private key = 103
Sender public key Pa = 103*(219, 118) = (51, 199)
Receiver's private key = 205
Receiver's public key Pb = 205*(219, 118) = (39, 218)
*************** ECC Message Encryption ***************
Encrypted Message from Source at Receiver = {Pa,c1,c2} = {(51, 199), 218, 0}
Where,
Pa is the public key of sender node
c1 means encrypted hash value of sender node
c2 means encrypted hash value of receiver node
*************** ECC Message Decryption ***************
Decrypted Message at Receiver = (100, 0)
Sender node is successfully verified
Authentication of node12 is ensured