{'fraction_non_alphanumeric': 0.024553019691851363, 'fraction_numerical': 0.0128532586306336, 'mean_word_length': 4.7882689556509295, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Comparison Based Analysis of Different Cryptographic and Encryption Techniques Using Message Authentication Code (MAC) in Wireless Sensor Networks (WSN)

Wireless Sensor Networks (WSN) are becoming popular day by day, however one of the main issue in WSN is its limited resources. We have to look to the resources to create Message Authentication Code (MAC) keeping in mind the feasibility of technique used for the sensor network at hand. This research work investigates different cryptographic techniques such as symmetric key cryptography and asymmetric key cryptography. Furthermore, it compares different encryption techniques such as stream cipher (RC4), block cipher (RC2, RC5, RC6 etc) and hashing techniques (MD2, MD4, MD5, SHA, SHA1 etc). The result of our work provides efficient techniques for communicating device, by selecting different comparison matrices i.e. energy consumption, processing time, memory and expenses that satisfies both the security and restricted resources in WSN environment to create MAC.

With the wide deployment of WSN for multi-faceted applications security is becoming a growing concern. For example, in a battlefield, a military communication network used for sensitive information interchange can be hacked by its adversaries if the WSN has security holes causing severe loss of life and machinery. Similarly, many social problems can be created if personal information flowing on health care systems is intercepted [16].
Security of WSN is a big challenge due to its limited resources such as energy, power supplies, small memory, computation and communication capabilities [17], [18], [19], [20], [1]. This is the reason that traditional security techniques cannot be applied on sensor networks, indirectly rising the need to make sensor network economically feasible [21], [22].
Cryptographic algorithm plays an important role in the security and resource conservation of wireless sensor networks (WSN) [23], [24]. This work spotlights different cryptographic techniques and compares different encryption techniques such as stream cipher (RC4), block cipher (RC2, RC5, RC6 etc) and hashing techniques (MD2, MD4, MD5, SHA, SHA1 etc). Our main aim of working in this survey paper is to put forward a cryptographic and encryption technique that creates Message Authentication Code (MAC) in wireless sensor networks (WSN), which is more feasible in the restricted resources of wireless sensor networks (WSN) and also provide good security in communication as well.
The rest of the paper is outlined as follows. We present our critical review questions in section II; then we analyze these review questions in section III and finally we deduct our conclusion in section IV.

Research Questions
The critical review questions we are in quest of to answer are:  Why we prefer symmetric keys over public keys in WSN?  Which method and algorithm is best to create MAC in Wireless Sensor Networks?
 Can we apply all given methods to create MAC like block cipher, stream cipher, hash function and unconditional secure?

Analysis and Discussion
In this section we analyze the result of our research questions. Our questions are: 3.1 Why we prefer symmetric keys over public keys in WSN?
Symmetric key technique uses a single key called secret key which uses less mathematics, results in less computation, on the other hand asymmetric key technique uses both public and private keys, results in more processing and consumes more energy. Symmetric key techniques offer better energy efficiency as compared to public key that is why most researches use it for creating MAC in WSN.
According to [25] public key is used in some applications for secure communications e.g. SSL (Secure Socket Layer) and IPsec standards both use it for their key agreement protocols. But it consumes more energy and also it is more expensive as compared to symmetric key.
[26] has given a reason that public key consumes more energy due to great deal of computation and processing involved, which makes it more energy consumptive as compared to symmetric key technique e.g. a single public key operation can consume same amount of time and energy as encrypting tens of megabits using a secret key cipher.
According to [27], the more consumption of computational resources of public key techniques is due to the fact that it uses two keys. One of which is public and is used for encryption, and every one can encrypt a message with it and other is private on which only decryption takes place and both keys has a mathematical link, the private key can be derived from a public key. In order to protect it from attacker the derivation of private key from the public is made difficult as possible like taking factor of a large number which makes it impossible computationally. Hence, it shows that more computation is involved in asymmetric key technique thus we can say that symmetric key is better to choose for WSN.
According to [28] the cost of public key is much more expensive as compared to symmetric key for instance, a 64 bit RC5 encryption on ATmega128 8MHz takes 5.6 milliseconds, and a 160 bit SHA1 has function evaluation takes only 7.2 millisecond's. These symmetric key algorithms are more than 200 times faster than Public key algorithms.
Public key cryptography is not only expensive in computation but also it is more expensive in communication as compared to symmetric key cryptography. According to [4] to send a public key from one node to another, at least 1024 bits required to be sent if the private key is 1024 bits long.

Which method and algorithm is best to create MAC in Wireless Sensor Networks?
According to [29] Block Cipher is more secure as compared to Stream Cipher this is because of the facts:  Attacks such as differential attacks on block cipher are also applied to stream cipher.  Attacks such as correlation attacks on stream cipher are not valid on block cipher.  Algebraic attacks on stream cipher are more effective.  Guess and set attacks against stream ciphers recover the key or any plaintext.  Generic time/memory attacks are stronger against stream cipher than block cipher.
Because of these facts it shows that block cipher is more secure as compared to stream cipher and thus the stream cipher will be replaced with block cipher except few applications.
[30] Compared different attacks on Hash function like birthday attack. He uses MD5 algorithm for this attack and finds out that such an attack needs 2 64 blocks (or 2 73 bits) of data for authentication using the same key. If the communication link has the ability to process 1 Gbit/sec it means one need 250,000 years to process the data needed by such an attack. Even according to [30] on software implementation the popular hash function is faster than the block cipher.
As stream cipher uses a key "K" and initialization vector (IV) for encryption making it more vulnerable to retrieve the plaintext in case different packets use the same IV. If initialization vector is long then it will require additional bytes but our aim is to reduce the packet overhead. Thus we follow the principle "use an encryption scheme that is as robust as possible in the presence of repeated IVs". As stream cipher does not follow this principle so the only way is to use block cipher.
Block cipher has different algorithms such as DES, AES, RC5 and Skipjack. The block cipher used for encryption has an extra advantage i.e. the most efficient MAC algorithm use a block cipher [31].
After choosing block cipher for creating MAC, we need to choose algorithm in block cipher. DES is very slow when it is implemented in software. Similarly, experimentations show that AES is quite slow. We find that RC5 and Skipjack are more suitable for sensor networks. One can outperform the other on specific hardware platform. For example, on TinySec platform, although RC5 is slightly faster than Skipjack but it uses 104 extra bytes of RAM per key for good performance. Therefore the default block cipher in TinySec is Skipjack [31]. [31] tested the performance of RC5 and Skipjack on Mica2 sensor node to determine the speed of these two 64 bit block cipher. The time to execute cipher operation on the Mica 2 sensor node is shown as in the Table 1. RC5 was chosen on this platform because it uses less memory. [28] Also found that hashing techniques requires an order of magnitude higher overhead.
The parameters used in our paper are shown as in Table 2.  Table 3. Table 3: Hardware platforms [28] Experiments have been performed for different values of selected parameters on all these algorithms, architecture and considered platforms. The functional block of all these algorithms i.e. initialization, encryption and decryption was executed 1000 times using the same input and the result was averaged for these execution. The execution time overhead for each algorithm and for considered platforms on a log scale is shown as in the Figure1. These are also shown in Table 4.  After performing simulation of these algorithms [28] summarizes the result in Comparing RC5 with IDEA on the Atmega 103 showed that RC5 is 1.5 times faster than IDEA. However, both of these algorithms use 64 bit blocks. Hashing techniques needs almost an order of a magnitude higher overhead. Thus RC5 is faster compared to other algorithms like RC4 and IDEA so it requires less processing time and thus less energy consumption.  [32] Shows Skipjack and XXTEA have efficient energy consumption and smaller memory requirements while RC5 and AES provide better security. The energy consumption on RC5 and AES depends on the key size and number of rounds respectively. RC5 consumes more energy in its encryption phase than that of AES on MicaZ, but overall energy consumption and memory of RC5 is less. Similarly on TelosB, RC5 consume less energy for both encryption and decryption than AES and uses less memory.
RC5 provide good security against different attacks and is also a fast block cipher algorithm suitable for both hardware and software implementation. Since it is a parameterized algorithm having variable features (like block size, number of rounds and length secret key) it provides flexibility in both performance and security [31], [33].
3.3 Can we apply all given methods to create MAC like block cipher, hash function and stream cipher etc?
Yes we can, but we have to look to the resources and we need to choose such a technique which is feasible for sensor networks. In case of more resources the best option is to go for hash function because it provides better security. But according to the current situation, sensor network has limited resources, it is common practice to use block cipher for implementation of MAC in sensor networks as it requires less resources comparatively.
Thus, from the above discussion we conclude that block cipher is the best option to create MAC in WSNs.

Conclusion
In this paper we investigate that public key is not energy efficient and is expensive in terms of both computation and communication as compared to symmetric key. Sensor networks has limited resources, therefore most of the researcher used symmetric key to create MAC in WSNs. Thus, we conclude that symmetric key techniques are more feasible for WSNs as compared to public key.
After selecting symmetric key techniques, we compared different attacks on hashing techniques and conclude that it offers good security mechanisms as compared to block cipher. However, it requires an order of magnitude higher overhead and also uses more memory. While stream cipher, Skipjack and XXTEA are less secure than block cipher and for encryption packets overhead also takes place in stream cipher. By selecting an efficient technique, we pick block cipher as best technique to create Message authentication code (MAC) in sensor network although hash function offers good security.
We conclude that RC5 is feasible and consumes less energy/resources as compared to other algorithms (AES, MD5, SHA1, IDEA) except Skipjack and XXTEA. However, RC5 is more secure than Skipjack and XXTEA. Thus we propose that RC5 is a best algorithm to create MAC in sensor networks.