**3.5 The algorithms**

In this section, the algorithms of HGEA encryption and decryption are explained step by step. First, the encryption algorithm is given below.


## *Hybrid Approaches to Block Cipher DOI: http://dx.doi.org/10.5772/intechopen.82272*


characters by referring the standard ASCII table, as illustrated in **Table 9**, and this is

Decryption is also performed in the same manner as encryption but in reverse order. The steps involved in decryption are: (1) conversion and arrangement, (2) plotting, (3) selection, (4) transformation and (5) arrangement and conversion.

In this section, the algorithms of HGEA encryption and decryption are explained

*Input*: Plaintext p, which is divided into n 8-bit characters. Each 8-bit value ASCII character is converted into 64-bit binary values in 8 � 8 matrix Mp, which is the input for the algorithm. Similarly,

*Output*: Ciphertext C, where C can be decrypted using key K to its corresponding plain-text P.

step by step. First, the encryption algorithm is given below.

our ciphertext.

**Table 9.**

**Table 8.**

*Permutations P3 and P4 for M3 and M4.*

*Computer and Network Security*

**3.5 The algorithms**

**3.4 The decryption process**

*Example conversion of ASCII cipher into binary.*

**Algorithm 1**: **HGEA encryption**

64-bit random key (K) is used.

1: Mp a(i, j); where 0 < (i, j) < 7

3: for, (i = 0; i < 4; i++);

**152**

2: Split 8 � 8 matrix into M1, M2, M3, M4, 4 � 4 matrix.


25: Remainder(R) ∑1's in Ki / 4, for corresponding Mi respectively.

26: For Ri = n, Qis = n + 1.

*Hybrid Approaches to Block Cipher*

29: 1st row no shift

35: 2nd row no shift

40: 3rd row no shift

46: 4th row no shift

48: Mi Mi' ⊕ Kis

28: If Qs = 1

33: If Qs = 2

37: If Qs = 3

42: if Qs = 4

27: Perform Right Shift Operation circularly:

*DOI: http://dx.doi.org/10.5772/intechopen.82272*

30: Left circular shift the 2nd row by 1 bit 31: Left circular shift the 3rd row by 2 bits 32: Left circular shift the 4th row by 3 bits

34: Left circular shift the 1st row by 3 bits

36: Left circular shift the 3rd row by 1 bit 35: Left circular shift the 4th row by 2 bits

38: Left circular shift the 1st row by 2 bits 39: Left circular shift the 2nd row by 3 bits

41: Left circular shift the 4th row by 1 bit

43: Left circular shift the 4th row by 1 bit 44: Left circular shift the 4th row by 2 bits 45: Left circular shift the 4th row by 3 bits

47: Selected quadrant value (Kis) Qs

50: Mp (M1cipher + M2cipher) (M4cipher + M3cipher) 51: Convert above result to string to get plaintext.

computation time and decryption computation time. [20]

can be used to calculate the encryption throughput of the algorithms.

*3.6.1 Computation time for encryption and decryption*

decryption throughput of the algorithms.

**155**

Performance measurement criterion is the time taken by the algorithms to perform encryption and decryption of the input text file, that is, the encryption

The encryption computation time of the encryption algorithm is the time taken by the algorithm to produce the ciphertext from the plaintext. The encryption time

The decryption computation time is the time taken by the algorithms to produce the plaintext from the ciphertext. The decryption time can be used to calculate the

49: Generate M1, M2, M3 and M4.

**3.6 Performance evaluation**

Next, the decryption algorithm is given below.


#### *Hybrid Approaches to Block Cipher DOI: http://dx.doi.org/10.5772/intechopen.82272*

45: 4th row no shift

*Computer and Network Security*

48: For Qis = Ri + 1.

49: Generate K1', K2', K3' and K4'

51: Compute: Mi\* Mis ⊕ Ki' 52: Mi cipher = π (Mi\*)

**Algorithm 2**: **HGEA decryption**

64 bit random key (K) is used.

3: for, (i = 0; i < 4; i++); 4: for, (j = 0; j < 4; j++); 5: M1" [i] [j] Mc; 6: for, (i = 0; i < 4; i++); 7: for, (j = 0; j < 4; j++);

8: i = j + 4;

11: k = i + 4:

15: k = i + 4:

17: l = j + 4;

**154**

9: M2" [i] [j] Mc; 10: for, (i = 0; i < 4; i++);

12: for, (j = 0; j < 4; j++); 13: M3" [i] [j] Mc; 14: for, (i = 0; i < 4; i++);

16: for, (j = 0; j < 4; j++);

18: M4" [i] [j] Mp;

20: Mi cipher = π (Mi\*) 21: Generate K1', K2', K3' and K4'

23: Compute: Mi\* Mis ⊕ Ki'

19: Generate K1, K2, K3, K4 from K similar to plaint text.

22: Ki' = πi(Ki),where π = fixed permutation table.

24: Compute selected quadrant value (Qs):

1: Mc a(i, j); where 0 < (i, j) < 7

46: Compute selected quadrant value (Qs):

50: Ki' = πi(Ki),where π = fixed permutation Table.

53: M cipher (M1cipher + M2cipher) (M4cipher + M3cipher) 54: Convert each row of 8 � 8 matrix binary into ciphertext

Next, the decryption algorithm is given below.

*Output*: Plaintext P, where P is decrypted to plaintext using key K.

2: Split 8 � 8 matrix into M1", M2", M3", M4" 4 � 4 matrix.

*Input*: Ciphertext C which is divided into n 8-bit characters. Each 8-bit value ASCII character is converted into 64-bit binary values in 8 � 8 matrix Mc, which is the input for the algorithm. Similarly,

47: Remainder (Ris) ∑1's in Ki/4, for corresponding Mi respectively.
