# Matrix Encryption Walks for Lightweight Cryptography

^{1}

^{2}

^{*}

## Abstract

**:**

## 1. Introduction

- We have built on prior research in the using of both lattices and matrices for alternative encryption schemes that eschew traditional Feistel cipher rounds.
- We have developed a new model for encrypting data on low-resource and IoT devices.
- We have provided extended theoretical examination of the model’s potential security benefits.
- We have provided a Proof of Concept algorithm, which is available for further examination in Python at a GitHub repository, with the link in the text, and a full step-by-step example of the encryption process in two different ways (see Section 3.2 and Section 3.3).
- We have provided an overview of the resource requirements and the execution of the algorithm in practice using said Proof of Concept algorithm.
- We have discussed these results and highlighted important directions for future research in this area, particularly noting potential examinations for cryptanalysis of the algorithm.

## 2. Related Work

#### 2.1. Matrix Encryption Schemes

#### 2.2. Graph Walks and Lattices

#### 2.3. Lightweight Encryption Methods

## 3. Proof of Concept and Use

#### 3.1. Methodology

#### 3.2. MEW Algorithm Process

#### 3.3. Example Outputs

#### 3.4. Execution Time

## 4. Security of the Algorithm

#### 4.1. Avalanche Effect

#### 4.2. Key Space

#### 4.3. Frequency Analysis

“It is a truth universally acknowledged that a single man in possession of a good fortune must be in want of a wife.”

42 183 90 0 213 209 246 49 101 66 200 155 46 81 50 48 122 233 133 222 119 129 176 47 45 196 152 143 207 123 150 239 215 62 121 153 92 232 199 67 40 13 191 48 91 161 26 49 209 85 37 85 174 255 252 49 12 53 247 67 50 20 193 184 164 120 188 196 144 212 55 186 184 130 150 177 129 124 88 208 60 110 147 194 111 105 9 20 54 33 220 171 230 165 85 151 13 194 255 140 156 227 159 50 92 94 103 97 163 103 195 77 115 41 128 39 205 21 19

¿0[¡1ÑU%U®ÿü1zéÞw°/-ÄÏï×>yÇC(

Âÿã2ĝa£gÃMs)’ÍÐ<nÂoi 6!Ü«æ¥U

#### 4.4. Shannon Entropy

#### 4.5. Chosen and Known Plaintext/Ciphertext Attacks

## 5. Discussion and Future Research

## 6. Conclusions

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## Abbreviations

AES | Advanced Encryption Standard |

CME | Coordinate Matrixx Encryption |

DES | Data Encryption Standard |

DESL | Data Encryption Standard Light |

ECC | Elliptic Curve Cryptography |

IoT | Internet of Things |

MASK | Katrix Array Symmetric Key |

MDPI | Multidisciplinary Digital Publishing Institute |

MEW | Matrix Encryption Walks |

NIST | National Institute of Standards |

PC | Personal Computer |

RAM | Random Access Memory |

XOR | Exclusive OR operation |

## References

- Hell, M.; Johansson, T.; Maximov, A.; Meier, W. A Stream Cipher Proposal: Grain-128. In Proceedings of the 2006 IEEE International Symposium on Information Theory, Seattle, WA, USA, 9–14 July 2006; pp. 1614–1618. [Google Scholar] [CrossRef]
- Singh, S.; Sharma, P.K.; Moon, S.Y.; Park, J.H. Advanced lightweight encryption algorithms for IoT devices: Survey, challenges and solutions. J. Ambient. Intell. Humaniz. Comput.
**2017**, 1–18. [Google Scholar] [CrossRef] - Duarte, F. Number of IOT Devices (2023–2030). Exploding Topics. 2023. Available online: https://explodingtopics.com/blog/number-of-iot-devices (accessed on 29 July 2023).
- Atkins, D. Requirements for post-quantum cryptography on embedded devices in the IoT. In Proceedings of the Third PQC Standardization Conference, Virtual, 7–9 June 2021. [Google Scholar]
- Kumar, S.; Tiwari, P.; Zymbler, M. Internet of Things is a revolutionary approach for future technology enhancement: A review. J. Big Data
**2019**, 6, 111. [Google Scholar] - Cusack, B.; Chapman, E. Using graphic methods to challenge cryptographic performance. In Proceedings of the 14th Australian Information Security Management Conference, Edith Cowan University, Perth, Australia, 5–6 December 2016; pp. 30–36. [Google Scholar]
- Chapman, E. Using Graphic Based Systems to Improve Cryptographic Algorithms. Ph.D. Thesis, Auckland University of Technology, Auckland, New Zealand, 2016. [Google Scholar]
- Kinani, E.H.E. Fast Mapping Method based on Matrix Approach For Elliptic Curve Cryptography. Int. J. Inf. Netw. Secur. (IJINS)
**2012**, 1, 54–59. [Google Scholar] [CrossRef] - Balamurugan, R.; Kamalakannan, V.; Rahul, G.D.; Tamilselvan, S. Enhancing Security in Text Messages Using Matrix Based Mapping and ElGamal Method in Elliptic Curve Cryptography. In Proceedings of the 2014 International Conference on Contemporary Computing and Informatics (IC3I), Mysuru, India, 27–29 November 2014; pp. 103–106. [Google Scholar] [CrossRef]
- Abu-Faraj, M.; Al-Hyari, A.; Alqadi, Z. A Complex Matrix Private Key to Enhance the Security Level of Image Cryptography. Symmetry
**2022**, 14, 664. [Google Scholar] [CrossRef] - Kumar, T.; Chauhan, S. Image Cryptography with Matrix Array Symmetric Key using Chaos based Approach. Int. J. Comput. Netw. Inf. Secur.
**2018**, 10, 60–66. [Google Scholar] [CrossRef] - Stakhov, A. The “golden” matrices and a new kind of cryptography. Chaos Solitons Fractals
**2007**, 32, 1138–1146. [Google Scholar] [CrossRef] - McEliece, R.J. A Public-Key Cryptosystem Based On Algebraic Coding Theory. In Coding Thv. Technical Report 42–44; National Aeronautics and Space Administration, Jet Propulsion Laboratory, California Institute of Technology: Pasadena, CA, USA, 1978. [Google Scholar]
- Repka, M.; Zajac, P. Overview of the Mceliece Cryptosystem and its Security. Tatra Mt. Math. Publ.
**2014**, 60, 57–83. [Google Scholar] [CrossRef] - Ustimenko, V. On Graph-Based Cryptography and Symbolic Computations. Serdica J. Comput.
**2007**, 1, 131–156. [Google Scholar] [CrossRef] - Costache, A.; Feigon, B.; Lauter, K.; Massierer, M.; Puskás, A. Ramanujan graphs in cryptography. arXiv
**2018**, arXiv:1806.05709. [Google Scholar] [CrossRef] - Ustimenko, V. On semigroups of multiplicative Cremona transformations and new solutions of Post Quantum Cryptography. Cryptol. Eprint Arch. 2019. Available online: https://eprint.iacr.org/2019/133 (accessed on 29 July 2023).
- Ustimenko, V.A. On linguistic dynamical systems, families of graphs of large girth, and cryptography. J. Math. Sci.
**2007**, 140, 461–471. [Google Scholar] [CrossRef] - Nandhini, R.; Maheswari, V.; Balaji, V. A Graph Theory Approach on Cryptography. J. Comput. Math.
**2018**, 2, 97–104. [Google Scholar] [CrossRef] - Usman, M.; Ahmed, I.; Aslam, M.I.; Khan, S.; Shah, U.A. SIT: A Lightweight Encryption Algorithm for Secure Internet of Things. arXiv
**2017**, arXiv:1704.08688. [Google Scholar] [CrossRef] - Leander, G.; Paar, C.; Poschmann, A.; Schramm, K. New lightweight DES variants. In Proceedings of the Fast Software Encryption: 14th International Workshop, FSE 2007, Luxembourg, 26–28 March 2007; Revised Selected Papers 14. Springer: Berlin/Heidelberg, Germany, 2007; pp. 196–210. [Google Scholar]
- Biswas, A.; Majumdar, A.; Nath, S.; Dutta, A.; Baishnab, K.L. LRBC: A lightweight block cipher design for resource constrained IoT devices. J. Ambient. Intell. Humaniz. Comput.
**2020**, 14, 5773–5787. [Google Scholar] [CrossRef] - Rana, M.; Mamun, Q.; Islam, R. Lightweight cryptography in IoT networks: A survey. Future Gener. Comput. Syst.
**2022**, 129, 77–89. [Google Scholar] [CrossRef] - Turan, M.S.; McKay, K.; Chang, D.; Kang, J.; Waller, N.; Kelsey, J.M.; Bassham, L.E.; Hong, D. Status Report on the Final Round of the NIST Lightweight Cryptography Standardization Process. 2023. Available online: https://nvlpubs.nist.gov/nistpubs/ir/2023/NIST.IR.8454.pdf (accessed on 29 July 2023).
- Dobraunig, C.; Eichlseder, M.; Mendel, F.; Schläffer, M. Lightweight Authenticated Encryption & Hashing. Available online: https://ascon.iaik.tugraz.at/ (accessed on 29 July 2023).
- Grover, L.K. A fast quantum mechanical algorithm for database search. In Proceedings of the 28th Annual ACM Symposium on Theory of Computing—STOC ’96, Philadelphia, PA, USA, 22–24 May 1996; pp. 212–219. [Google Scholar] [CrossRef]
- Malviya, A.K.; Tiwari, N.; Chawla, M. Quantum cryptanalytic attacks of symmetric ciphers: A review. Comput. Electr. Eng.
**2022**, 101, 108122. [Google Scholar] [CrossRef] - Jozsa, R. Searching in Grover’s Algorithm. arXiv
**1999**, arXiv:quant-ph/9901021. [Google Scholar] [CrossRef] - dCode. Frequency Analysis on dCode.fr. Available online: https://www.dcode.fr/frequency-analysis (accessed on 8 August 2023).
- Austen, J. Pride and Prejudice; Broadview Press: Peterborough, ON, Canada, 2001. [Google Scholar]
- Fredj, O.B.; Cheikhrouhou, O.; Krichen, M.; Hamam, H.; Derhab, A. An OWASP Top Ten Driven Survey on Web Application Protection Methods. In Proceedings of the Risks and Security of Internet and Systems, Ames, IA, USA, 12–13 November 2021; Garcia-Alfaro, J., Leneutre, J., Cuppens, N., Yaich, R., Eds.; Springer: Cham, Switzerland, 2021; pp. 235–252. [Google Scholar]
- Hell, M.; Johansson, T.; Meier, W. Grain: A stream cipher for constrained environments. Int. J. Wirel. Mob. Comput.
**2007**, 2, 86. [Google Scholar] [CrossRef]

**Figure 1.**A simplistic view showing how the MEW algorithm weaves between the two Key Matrices byte by byte. Each different color represents a different plaintext byte.

**Figure 4.**The example input and output of a binary CME scheme. The extra length of the ciphertext can be a detractor when looking at resource-constrained environments [7]. (Reprinted with permission from the author.)

**Figure 5.**The process a single plaintext string goes through for encryption and decryption using the Matrix Graph Walk scheme. Example uses a 16-byte plaintext and size 32 Key Matrices.

**Figure 6.**An example of interaction between two 16 × 16 Matrix Keys for the purpose of encryption. The byte in the location in the first key is used, then after direction and movement are obtained and used, the byte from the matching location in the second key is used, before moving to the corresponding current location in the first key.

**Table 1.**Encryption directions based on the final two bits of the result of an XOR with the plaintext and the key byte.

Bits | Direction | |
---|---|---|

Encryption | Decryption | |

00 | Down | Up |

11 | Up | Down |

01 | Right | Left |

10 | Left | Right |

**Table 2.**The full process of encrypting and decryption of a 16-byte string using a set of 32 × 32 Key Matrices.

Original Plaintext: | ||||||
---|---|---|---|---|---|---|

kztrspodbxxsxwgv | ||||||

Plaintext as Byte Array: | ||||||

[107, 122, 116, 114, 115, 112, 111, 100, 98, 120, 120, 115, 120, 119, 103, 118] | ||||||

Encryption Pass 1: | ||||||

Index | PositionKM1 | CurrentByte | Direction | Numberof Spaces | PositionKM2 | CiphertextByte |

0 | [0,0] | 107 | 10 | 26 | [6,0] | 244 |

1 | [6,0] | 122 | 10 | 25 | [13,0] | 237 |

2 | [13,0] | 116 | 1 | 2 | [15,0] | 217 |

3 | [15,0] | 114 | 1 | 2 | [17,0] | 108 |

4 | [17,0] | 115 | 11 | 28 | [17,4] | 88 |

5 | [17,4] | 112 | 0 | 10 | [17,14] | 195 |

6 | [17,14] | 111 | 1 | 18 | [3,14] | 149 |

7 | [3,14] | 100 | 1 | 22 | [25,14] | 142 |

8 | [25,14] | 98 | 10 | 12 | [13,14] | 40 |

9 | [13,14] | 120 | 1 | 29 | [10,14] | 227 |

10 | [10,14] | 120 | 10 | 1 | [9,14] | 201 |

11 | [9,14] | 115 | 10 | 7 | [2,14] | 176 |

12 | [2,14] | 120 | 10 | 8 | [26,14] | 238 |

13 | [26,14] | 119 | 11 | 4 | [26,10] | 139 |

14 | [26,10] | 103 | 11 | 11 | [26,31] | 92 |

15 | [26,31] | 118 | 0 | 13 | [26,12] | 186 |

Encryption Result Stage 1: | ||||||

[244, 237, 217, 108, 88, 195, 149, 142, 40, 227, 201, 176, 238, 139, 92, 186, 26, 12] | ||||||

Reversed: | ||||||

[12, 26, 186, 92, 139, 238, 176, 201, 227, 40, 142, 149, 195, 88, 108, 217, 237, 244] | ||||||

Encryption Pass 2 (Final): | ||||||

Index | PositionKM1 | CurrentByte | Direction | Numberof Spaces | PositionKM2 | CiphertextByte |

0 | [0,0] | 12 | 1 | 3 | [3,0] | 9 |

1 | [3,0] | 26 | 0 | 13 | [3,13] | 39 |

2 | [3,13] | 186 | 1 | 15 | [18,13] | 53 |

3 | [18,13] | 92 | 1 | 29 | [15,13] | 117 |

4 | [15,13] | 139 | 11 | 1 | [15,12] | 248 |

5 | [15,12] | 238 | 10 | 14 | [1,12] | 98 |

6 | [1,12] | 176 | 10 | 26 | [7,12] | 11 |

7 | [7,12] | 201 | 1 | 22 | [29,12] | 77 |

8 | [29,12] | 227 | 1 | 2 | [31,12] | 188 |

9 | [31,12] | 40 | 10 | 17 | [14,12] | 98 |

10 | [14,12] | 142 | 0 | 26 | [14,6] | 231 |

11 | [14,6] | 149 | 1 | 21 | [3,6] | 145 |

12 | [3,6] | 195 | 0 | 4 | [3,10] | 136 |

13 | [3,10] | 88 | 1 | 7 | [10,10] | 71 |

14 | [10,10] | 108 | 10 | 7 | [3,10] | 6 |

15 | [3,10] | 217 | 0 | 7 | [3,17] | 19 |

16 | [3,17] | 237 | 0 | 12 | [3,29] | 187 |

17 | [3,29] | 244 | 1 | 0 | [3,29] | 138 |

Encrypted Result Stage 2 (Final)/Output Ciphertext: | ||||||

[9, 39, 53, 117, 248, 98, 11, 77, 188, 98, 231, 145, 136, 71, 6, 19, 187, 138, 3, 29] | ||||||

Decryption Pass 1: | ||||||

Index | PositionKM1 | CurrentByte | Direction | Numberof Spaces | PositionKM2 | CiphertextByte |

17 | [3,29] | 0 | 1 | 0 | [3,29] | 129 |

16 | [3,29] | 0 | 0 | 12 | [3,17] | 176 |

15 | [3,17] | 0 | 0 | 7 | [3,10] | 28 |

14 | [3,10] | 0 | 10 | 7 | [10,10] | 158 |

13 | [10,10] | 0 | 1 | 7 | [3,10] | 157 |

12 | [3,10] | 0 | 0 | 4 | [3,6] | 16 |

11 | [3,6] | 0 | 1 | 21 | [14,6] | 213 |

10 | [14,6] | 0 | 0 | 26 | [14,12] | 104 |

9 | [14,12] | 0 | 10 | 17 | [31,12] | 70 |

8 | [31,12] | 0 | 1 | 2 | [29,12] | 137 |

7 | [29,12] | 0 | 1 | 22 | [7,12] | 217 |

6 | [7,12] | 0 | 10 | 26 | [1,12] | 106 |

5 | [1,12] | 0 | 10 | 14 | [15,12] | 186 |

4 | [15,12] | 0 | 11 | 1 | [15,13] | 7 |

3 | [15,13] | 0 | 1 | 29 | [18,13] | 245 |

2 | [18,13] | 0 | 1 | 15 | [3,13] | 61 |

1 | [3,13] | 0 | 0 | 13 | [3,0] | 180 |

0 | [3,0] | 0 | 1 | 3 | [0,0] | 13 |

Decryption Result Stage 1: | ||||||

[12, 26, 186, 92, 139, 238, 176, 201, 227, 40, 142, 149, 195, 88, 108, 217, 237, 244] | ||||||

Reversed: | ||||||

[244, 237, 217, 108, 88, 195, 149, 142, 40, 227, 201, 176, 238, 139, 92, 186, 26, 12] | ||||||

Decryption Pass 2 (Final): | ||||||

Index | PositionKM1 | CurrentByte | Direction | Numberof Spaces | PositionKM2 | CiphertextByte |

15 | [26,12] | 0 | 0 | 13 | [26,31] | 180 |

14 | [26,31] | 0 | 11 | 11 | [26,10] | 47 |

13 | [26,10] | 0 | 11 | 4 | [26,14] | 147 |

12 | [26,14] | 0 | 10 | 8 | [2,14] | 162 |

11 | [2,14] | 0 | 10 | 7 | [9,14] | 30 |

10 | [9,14] | 0 | 10 | 1 | [10,14] | 134 |

9 | [10,14] | 0 | 1 | 29 | [13,14] | 117 |

8 | [13,14] | 0 | 10 | 12 | [25,14] | 178 |

7 | [25,14] | 0 | 1 | 22 | [3,14] | 217 |

6 | [3,14] | 0 | 1 | 18 | [17,14] | 73 |

5 | [17,14] | 0 | 0 | 10 | [17,4] | 40 |

4 | [17,4] | 0 | 11 | 28 | [17,0] | 243 |

3 | [17,0] | 0 | 1 | 2 | [15,0] | 137 |

2 | [15,0] | 0 | 1 | 2 | [13,0] | 137 |

1 | [13,0] | 0 | 10 | 25 | [6,0] | 230 |

0 | [6,0] | 0 | 10 | 26 | [0,0] | 106 |

Decryption Result Stage 2 (Final)/Original Plaintext: | ||||||

[107, 122, 116, 114, 115, 112, 111, 100, 98, 120, 120, 115, 120, 119, 103, 118] | ||||||

Success |

**Table 3.**Execution time for the Proof of Concept algorithm with Key Matrix of size 8 × 8 in milliseconds.

Data Length | Encryption | Decryption |
---|---|---|

1024 | 0.578125 | 0.53125 |

2048 | 0.28125 | 0.484375 |

4096 | 1.890625 | 2.125 |

8192 | 3.140625 | 3.140625 |

16,384 | 6.015625 | 5.109375 |

**Table 4.**Execution time for the Proof of Concept algorithm with Key Matrix of size 16 × 16 in milliseconds.

Data Length | Encryption | Decryption |
---|---|---|

1024 | 0.265625 | 0.15625 |

2048 | 1.09375 | 0.59375 |

4096 | 0.578125 | 0.359375 |

8192 | 3.1875 | 3.4375 |

16,384 | 7.453125 | 6.953125 |

**Table 5.**Execution time for the Proof of Concept algorithm with Key Matrix of size 32 × 32 in milliseconds.

Data Length | Encryption | Decryption |
---|---|---|

1024 | 0.546875 | 0.5 |

2048 | 0.90625 | 0.75 |

4096 | 1.984375 | 1.796875 |

8192 | 3.609375 | 3.046875 |

16,384 | 5.890625 | 6.25 |

**Table 6.**Average time taken to generate the secure random Key Matrix by size over the course of 5000 iterations (measured in milliseconds).

Key Length | Key Generation Time |
---|---|

8 | 0.021875 |

16 | 0.05 |

32 | 0.1625 |

64 | 0.621875 |

128 | 2.41875 |

256 | 8.040625 |

Key Size | Plaintext Length | Avalanche Effect |
---|---|---|

128 | 256 | 99.13% |

256 | 256 | 98.88% |

128 | 512 | 98.20% |

256 | 512 | 99.29% |

128 | 1024 | 97.73% |

256 | 1024 | 98.77% |

128 | 2048 | 95.53% |

256 | 2048 | 98.60% |

128 | 4096 | 91.76% |

256 | 4096 | 97.31% |

**Table 8.**The frequency of characters in the ciphertext compared to the frequency of letters in the English language according to [29].

Ciphertext Frequencies | English Frequencies | ||
---|---|---|---|

Character | Frequency | Letter | Frequency |

· | 12.16% | E | 12.70% |

U | 4.05% | T | 9.10% |

1 | 2.7% | A | 8.20% |

Ÿ | 2.7% | O | 7.50% |

Ü | 2.7% | I | 7.00% |

Ï | 2.7% | N | 6.70% |

\ | 2.7% | S | 6.30% |

Â | 2.7% | H | 6.10% |

Ã | 2.7% | R | 6.00% |

G | 2.7% | L | 4.00% |

¿ | 1.35% | D | 4.30% |

0 | 1.35% | C | 2.80% |

[ | 1.35% | U | 2.80% |

¡ | 1.35% | M | 2.40% |

∑ | 1.35% | W | 2.40% |

Ñ | 1.35% | F | 2.20% |

% | 1.35% | G | 2.00% |

® | 1.35% | Y | 2.00% |

Z | 1.35% | P | 1.90% |

É | 1.35% | B | 1.50% |

Þ | 1.35% | V | 1.00% |

W | 1.35% | K | 0.80% |

° | 1.35% | J | 0.20% |

/ | 1.35% | X | 0.20% |

- | 1.35% | Q | 0.10% |

Ä | 1.35% | Z | 0.10% |

**Table 9.**The calculated Shannon entropy for the English language string introduced in Section 4.3.

Shannon Frequency | ||
---|---|---|

Text Type | Actual | Ideal |

English Language Quote | 6.556459254850041 | 6.894817763307944 |

Random | 6.440283306064294 | 6.94251450533924 |

Random | 6.462680765431477 | 6.94251450533924 |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Dunmore, A.; Samandari, J.; Jang-Jaccard, J.
Matrix Encryption Walks for Lightweight Cryptography. *Cryptography* **2023**, *7*, 41.
https://doi.org/10.3390/cryptography7030041

**AMA Style**

Dunmore A, Samandari J, Jang-Jaccard J.
Matrix Encryption Walks for Lightweight Cryptography. *Cryptography*. 2023; 7(3):41.
https://doi.org/10.3390/cryptography7030041

**Chicago/Turabian Style**

Dunmore, Aeryn, Juliet Samandari, and Julian Jang-Jaccard.
2023. "Matrix Encryption Walks for Lightweight Cryptography" *Cryptography* 7, no. 3: 41.
https://doi.org/10.3390/cryptography7030041