Numerous network can be connected by using the mobile ad hoc network. It can have security attacks like the worm hole, denial of service attack, jellyfish and also the blackhole. During this they take a path which is the shortest for the place where it has to reach. During sending of message two types of attacks are generally seen such as the blackhole attack and the wormhole attack. In this research we have tried to focus on two major attacks such as the black hole and the worm hole attack. In this we have used two types of protocol such as the AODV whose other name is SWBAODV and the scalable-dynamic elliptic curve cryptography. During the use the prime numbers are selected at random. We can also choose certain specific prime number. Moreover the security level does not depend on the size of the key. Keeping A as worm hole and B as the black hole we have made a two dimensional vector function named as F [A, B]. Two types of study is done by us in our research such as the with attack and without attack. In case of no attack study we have shown graphically using the AODV and the in case of attack we have given it as the BAODV and also the WAODV. Here we have applied a specific method SWBAODV to our selected attack case. The results were found to be interesting for the case of, packet delivery ratio and end to end delay was near 188.40 on comparing it with the BAODV and the WAODV. It has shown 51.38% more value compared to the BAODV and WAODV. There has been a drastic fall in the value of delay and it reached to a 63.2 for BAODV to WAODV. The other two things which we have discussed here is the consumption of energy and the overhead routing. The results in case of SWBAODV were good compared with the consumption of energy and save about 73.52% with the attacked case and around 69.35% with the routing done on the BAODV and WAODV. From our study we were able to say that it will give protection to the (MANET).