**3.2. RSA algorithm**

In the introductory paper about RSA, the authors [25] proposed a method to implement a public key cryptosystem whose security is based on the difficulty to be factoring large prime numbers. Through this technique it is possible to encrypt data and to create digital signatures. It was so successful that today is the RSA public key algorithm used most in the world. The encryption scheme uses RSA and signature of the fact that:

$$m^{ed} \equiv m(modn) \tag{1}$$

for m integer. The encryption and decryption schemes are presented in Algorithms 1 and 2. The decryption works because *<sup>c</sup><sup>d</sup>* <sup>≡</sup> (*me*)*<sup>d</sup>* <sup>≡</sup> *<sup>m</sup>*(*modn*) . The safety lies in the difficulty of computing a clear text m from a ciphertext c*memodn* and the public parameters n (e).

**Algorithm 1:** RSA Encryption

8 Will-be-set-by-IN-TECH

The public key cryptography or asymmetric cryptography came up with a radical change of paradigms. According to Stallings [22] public key algorithms are based on mathematical functions, instead of permutation and substitution. Besides the single most important thing is that the public key cryptography is asymmetric, involving the use of two different keys, in contrast to the conventional symmetric encryption, which uses only one key. The use of two keys has profound consequences in the areas of confidentiality, key distribution and authentication. The main distinguishing feature of asymmetric encryption is that it allows the establishment of a secure communication between individuals, without the requirement

In this class of cryptographic algorithms are used two different keys for encryption and decryption: a public key and its corresponding private key. In this model, in accordance with figure 4, the receiver releases its public key to the sender can encrypt the message, but

The IEEE 802.15.4 standard of 2011 defines parameters for low-range personal area networks (LR-WPANs). The first version of this standard was launched in 2003, and the second one [20] was appointed to be the standard communication protocol for WSNs. The encryption mechanism specified in IEEE 802.15.4 standard is based on encryption symmetric key. But according to Sen [23] recent studies have shown that it is possible to implement public key encryption using the right selection of algorithms and associated parameters, and optimization techniques for low power. In some cases the public-key cryptography efficiently obtained similar or even greater than symmetric key encryption using keys smaller. According to Struik [24] is already proven that public-key algorithms developed are suitable

In the introductory paper about RSA, the authors [25] proposed a method to implement a public key cryptosystem whose security is based on the difficulty to be factoring large prime numbers. Through this technique it is possible to encrypt data and to create digital signatures. It was so successful that today is the RSA public key algorithm used most in the world. The

*<sup>m</sup>ed* <sup>≡</sup> *<sup>m</sup>*(*modn*) (1)

only the private key of the receiver, which is kept secret is able to decrypt it.

*3.1.2. Asymmetric encryption*

of the previous share a single cryptographic key.

**Figure 4.** Asymmetric Cryptography [22]

*3.1.3. Symmetric x asymmetric cryptography*

encryption scheme uses RSA and signature of the fact that:

for hardware in WSNs.

**3.2. RSA algorithm**

**Input**: RSA public key (n,e), Plain text m ∈ [0, n-1] **Output**: Cipher text c **begin 1.** Compute c = *m<sup>e</sup>* mod n **2.** Return c. **end**

**Algorithm 2:** Decryption RSA

```
Input: Public key (n,e),Private key d, Cipher text c
Output: Plain text m
begin
   1. Compute m = cd mod n
   2. Return m.
end
```
## **3.3. Algorithms based on curves**

The main idea of the algorithms based on curves is to build a set of points of an elliptic curve for which the discrete logarithm problem is intractable. According to Blake [26] cryptosystems based on elliptic curves is an interesting technology because they reach the same level of security systems such as RSA, using minor keys, and thus consuming less memory and processor resources. This characteristic makes them ideal for use in smart cards and other environments where features such as storage, time and energy are limited.

The scenario of using public key cryptographic algorithms are changing, because according to Koc [27] in terms of public key encryption algorithm RSA continues to lead the number of implementations, but the number of applications that are using algorithms elliptic curves is increasing considerably thanks to the standardization performed by NIST. The algorithms based on curves are standardized according to the ANSI X9.62, FIPS 186-2, IEEE 1363-2000 and ISO / IEC 15946-2. According to Amin [28] public key encryption includes algorithms for key agreement, encryption and digital signatures. Among the algorithms that operate in key agreement, it can mention the Elliptic Curve Diffie-Hellman (ECDH), data encryption on the Elliptic Curve Integrated Encryption Standard (ECIES) and generating the digital signature Elliptic Curve Digital Signature Algorithm (ECDSA ).

### *3.3.1. ECC algorithm*

In the mid-80 [29] and [30] proposed a method of cryptography based on elliptic curves ECC . According to creators of the ECC 4, an elliptic curve is a plane curve defined by the following equation:

$$y^2 = x^3 + a\mathbf{x} + b \tag{2}$$

<sup>4</sup> Elliptic curve cryptography. More information on the site of the workshop on Elliptic Curve Cryptography which is in issue. Site: http://ecc2011.loria.fr/index.html

### 10 Will-be-set-by-IN-TECH 226 Wireless Sensor Networks – Technology and Protocols

The efficiency of this algorithm is based on finding a discrete logarithm of a random element that is part of an elliptic curve. To get an idea of the applicability of the algorithms based on elliptic curves on devices with computational constraints [31] argue that the efficiency of ECC cryptographic algorithm with key sizes of approximately 160 bits is the same obtained using the RSA algorithm with 1024 bit key. Algorithms several features are based on elliptic curves, including key management, encryption and digital signature. Key management algorithms are used to share secret keys, encryption algorithms enable a confidential communication and digital signature algorithms authenticate a participant communication as well as validate the integrity of the message.

The procedures of decryption and encryption through elliptic curve analogous to ElGamal encryption scheme are described in the algorithms 3 and 4. The pure text m is first represented as a point M, and then encrypted by the addition to kQ, where k is an integer chosen randomly, and Q is the public key.

### **Algorithm 3:** *ElGamal elliptic curve encryption*

**Input**: Parameters field of elliptic curve ( p, E, P, n), Public key Q, Plain text m **Output**: Cipher text (*C*1, *C*2) **begin 1.** Represent the message m as a point M in E (*Fp*) **2.** Select *<sup>k</sup>* <sup>∈</sup> *<sup>R</sup>*[1,*n*−1] . **3.** Compute *C*<sup>1</sup> = *kP* **4.** Compute *C*<sup>2</sup> = *M* + *kQ*. **5.** Return (*C*1, *C*2) **end**

### **Algorithm 4:** *ElGamal elliptic curve decryption*

**Entrada**: Parameters field of elliptic curve ( p, E, P, n), Private key d, Cipher text (*C*1, *C*2) **Saída**: Plain text m **início**

```
1. Compute M = C2 − dC1, and m from M.
   2. Return (m).
fim
```
The transmitter transmits the points *C*<sup>1</sup> = *kPeC*<sup>2</sup> = *M* + *kQ* to receiver who uses his private key d to compute:

$$d\mathbb{C}\_1 = d(kP) = k(dP) = k\mathbb{Q}\_\prime \tag{3}$$

and then calculating *M* = *C*<sup>2</sup> − *kQ*. An attacker who wants to read of M need to calculate kQ. This model algorithm have been extensively studied since according to Amin [28] in recent years the ECC has attracted attention as a security solution for wireless networks, because the use of small keys and low computational overhead.

### *3.3.2. HECC algorithm*

The HECC was created in 1988 by Koblitz [32] as a generalization of elliptic curves. According to Batina [33] the unique difference between ECC and HECC is at average level that in this case consists of different sequences of operations. The HECC uses more complex operations, but works with smaller operands. According to Chatterjee [31] the hierarchy of operations in the HECC and ECC algorithms can be divided into three levels. The first level is the scalar multiplication on the second level are point operations group / splitter and the third level, finite field operations. The authors further inform that the main difference between the ECC and HECC is in the operations group, as different from the ECC, the points on the curve hiperelliptic not form a group. HECC is more complex than the ECC, but uses small numbers.

According to [27] a hyperelliptic curve is a special type of non-singular, projective curve. For our purposes, a hyperelliptic curve, of genus *<sup>g</sup>* 1 over k is the set of points (*X*,*Y*) <sup>∈</sup> *<sup>k</sup>*<sup>2</sup> that satisfy

$$y^2 + h(X)Y = f(X) \tag{4}$$

where *h* and *f* are polynomials in k[X] with *deg*(*f*) = 2*g* + 1, *deg*(*h*) ≤ *g*, together with a point "at infinity", *P*∞. An elliptic curve is just a hyperelliptic curve of genus 1.

## **3.4. Multivariate Quadratic Quasigroup (MQQ)**

The cryptographic algorithms presented above have their security based on computationally intractable mathematical problems: computational efficiency of calculating the discrete logarithm and integer factorization [1]. In 2008, it was proposed a new scheme called multivariate quadratic public key near group (MQQ) [34]. This algorithm is based on multivariate polynomial transformations of nearly quadratic and groups having the following properties [1, 34].


10 Will-be-set-by-IN-TECH

The efficiency of this algorithm is based on finding a discrete logarithm of a random element that is part of an elliptic curve. To get an idea of the applicability of the algorithms based on elliptic curves on devices with computational constraints [31] argue that the efficiency of ECC cryptographic algorithm with key sizes of approximately 160 bits is the same obtained using the RSA algorithm with 1024 bit key. Algorithms several features are based on elliptic curves, including key management, encryption and digital signature. Key management algorithms are used to share secret keys, encryption algorithms enable a confidential communication and digital signature algorithms authenticate a participant communication as well as validate the

The procedures of decryption and encryption through elliptic curve analogous to ElGamal encryption scheme are described in the algorithms 3 and 4. The pure text m is first represented as a point M, and then encrypted by the addition to kQ, where k is an integer chosen randomly,

**Input**: Parameters field of elliptic curve ( p, E, P, n), Public key Q, Plain text m

**Entrada**: Parameters field of elliptic curve ( p, E, P, n), Private key d, Cipher text (*C*1, *C*2)

The transmitter transmits the points *C*<sup>1</sup> = *kPeC*<sup>2</sup> = *M* + *kQ* to receiver who uses his private

and then calculating *M* = *C*<sup>2</sup> − *kQ*. An attacker who wants to read of M need to calculate kQ. This model algorithm have been extensively studied since according to Amin [28] in recent years the ECC has attracted attention as a security solution for wireless networks, because the

The HECC was created in 1988 by Koblitz [32] as a generalization of elliptic curves. According to Batina [33] the unique difference between ECC and HECC is at average level that in this

*dC*<sup>1</sup> = *d*(*kP*) = *k*(*dP*) = *kQ*, (3)

integrity of the message.

and Q is the public key.

**begin**

**end**

**início**

**fim**

**Output**: Cipher text (*C*1, *C*2)

**2.** Select *<sup>k</sup>* <sup>∈</sup> *<sup>R</sup>*[1,*n*−1]

**3.** Compute *C*<sup>1</sup> = *kP* **4.** Compute *C*<sup>2</sup> = *M* + *kQ*.

**5.** Return (*C*1, *C*2)

**Saída**: Plain text m

**2.** Return (m).

key d to compute:

*3.3.2. HECC algorithm*

**Algorithm 3:** *ElGamal elliptic curve encryption*

**1.** Represent the message m as a point M in E (*Fp*)

.

**Algorithm 4:** *ElGamal elliptic curve decryption*

**1.** Compute *M* = *C*<sup>2</sup> − *dC*1, and m from M.

use of small keys and low computational overhead.

According to Ahlawat [34, 35] MQQ gives a new direction for the cryptography field and can be used to develop new cryptosystems the public key as well as improve existing cryptographic schemes. Furthermore according to El-Hadely and Maia [2, 34] experiments showed that the hardware MQQ can be as fast as a typical symmetric block cipher, being several orders of magnitude faster than algorithms such as RSA, DH and ECC.

A generic description for the scheme is a typical system MQQ multivariate quadratic *T* ◦ *P*� ◦ *<sup>S</sup>* : {0, 1}*<sup>n</sup>* → {0, 1}*<sup>n</sup>* where T and S are two nonsingular linear transformations and P'is a multivariate mapping bijetivo quadratic over {0, 1}*n*. The mapping *<sup>P</sup>*� : {0, 1}*<sup>n</sup>* → {0, 1}*<sup>n</sup>* is defined in the algorithm 5.

The algorithm for encryption with the public key is the direct application of the set of n multivariate polynomials *P* = {*Pi*(*x*1, ..., *xn*)|*i* = 1, ..., *n*} on the vector *x* = (*x*1, ..., *xn*), or is *y* = *P*(*x*). Can be represented as *y* = *P*(*x*) ≡ *y* ≡ *A*.*X*. The algorithm 6 is described a decryption using the private key (*T*, *S*, ∗1, ..., ∗8).

**Algorithm 5:** Non-linear mapping P' **Input**: A vector *x* = (*f*1, ..., *fn*) of n linear Boolean functions of n variable. We implicitly suppose that a multivariate quadratic quasigroup \* is previously defined, and that n = 32k, k = 5,6,7,8 is also previously determined. **Output**: : 8 linear expressions *P*� *<sup>i</sup>*(*x*1, ..., *xn*), i = 1,...,8 andn-8 multivariate quadratic polynomials *P*� *<sup>i</sup>*(*x*1, ..., *xn*), *i* = 9, ..., *n*. **begin 1.** Represent a vector *x* = (*f*1, ..., *fn*) of n linear Boolean functions of n variables *x*1, ..., *xn* as a string *x* = (*X*1, ..., *Xn*/*s*) where *Xi* are vector of dimension 8; **2.** Compute *Y* = *Y*1, ...,*Yn*/8, where *Y*<sup>1</sup> = *X*1,*Yj*<sup>+</sup><sup>1</sup> = *Xj* ∗ *Xj*+1,for even j=2,4,...and *Yj*<sup>+</sup><sup>1</sup> = *Xj*<sup>+</sup><sup>1</sup> ∗ *Xj*, for odd j=3,5,... **3.** Output (y) **end**

**Algorithm 6:** Decryption Algorithm MQQ and sign with private key T, S, \*1,...,\*8

**Input**: Vector *y* = *y*1, ..., *yn* **Output**: Vector *x* = *x*1, ..., *xn* such that P(x) = y **begin 1.** y' = *<sup>T</sup>*−1(*y*). **2.** W = *y*� <sup>1</sup>, *y*� <sup>2</sup>, *y*� <sup>3</sup>, *y*� <sup>4</sup>, *y*� <sup>5</sup>, *y*� <sup>6</sup>, *y*� <sup>11</sup>, *y*� <sup>16</sup>, *y*� <sup>21</sup>, *y*� <sup>26</sup>, *y*� <sup>31</sup>, *y*� <sup>36</sup>, *y*� 41. **3.** Z = *Z*1, *Z*2, *Z*3, *Z*4, *Z*5, *Z*6, *Z*7, *Z*8, *Z*9, *Z*10, *Z*11, *Z*12, *Z*<sup>13</sup> = *Dob*−1(*W*). **4.** *y*� <sup>1</sup> ←− *Z*1, *y*� <sup>2</sup> ←− *Z*2, *y*� <sup>3</sup> ←− *Z*3, *y*� <sup>4</sup> ←− *Z*4, *y*� <sup>5</sup> ←− *Z*5, *y*� <sup>6</sup> ←− *Z*6, *y*� <sup>11</sup> ←− *Z*7, *y*� 16 ←− *Z*8, *y*� <sup>21</sup> ←− *Z*9, *y*� <sup>26</sup> ←− *Z*10, *y*� <sup>31</sup> ←− *Z*12, *y*� <sup>41</sup> ←− *Z*13. **5.** *y*� = *Y*1, ...,*Yk* onde *Yi* are vectors of dimension 5. **6.** Considering ∗*i*, i = 1,...,8, obter x' = *X*1, ..., *Xk*, such that, *<sup>X</sup>*<sup>1</sup> <sup>=</sup> *<sup>Y</sup>*1, *<sup>X</sup>*<sup>2</sup> <sup>=</sup> *<sup>X</sup>*1\1*Y*2, *<sup>X</sup>*<sup>3</sup> <sup>=</sup> *<sup>X</sup>*2\2*Y*3, *<sup>X</sup>*<sup>1</sup> <sup>=</sup> *Xi*−1\3+((*i*+2)*mod*6) *Yi* **7.** x = *S*−1(*x*� ) **end**
