A Novel ASCII Code-based Polybius Square Alphabet Sequencer as Enhanced Cryptographic Cipher for Cyber Security Protection (APSAlpS-3CS)

—For all industries, cybersecurity is regarded as one of the major areas of concern that needs to be addressed. Data and information in all forms should be safeguarded to avoid leakage of information, data theft, and robbery through intruders and hackers. This paper proposes a modification on the traditional 5x5 Polybius square in cryptography, through dynamically generated matrices. The modification is done through shifting cell elements for every encrypted character using a secret key and its ASCII decimal code equivalents. The results of the study revealed that the modified Polybius cipher offers a more secure plaintext-ciphertext conversion and is difficult to break, as evident in the frequency analysis. In the proposed method, each element produced in the digraphs exhibits a wider range of possible values. However, with the increase of process in the encryption and decryption, the modified Polybius cipher obtained a longer execution time of 0.0031ms, being identified as its tradeoff. The unmodified Polybius cipher, however, obtained an execution time of 0.0005ms. Future researchers may address the execution time tradeoff of the modified Polybius cipher.


I. INTRODUCTION
Cybersecurity has been the primary focus of all industries when it comes to communications security, as heterogeneous data needs to be safeguarded. As all industries leverage on the use of the internet, most of today"s transactions are carried out online as a medium of communication since mobile devices and Wi-Fis are readily available. All forms of data ranging from public to private organizations of all sizes possess valuable information and are vulnerable to attacks. Subsequently, data security implementation is still an ongoing quest, and managing information technology (I.T) security has become a challenge due to factors such as the unavailability of experts and the cost involved. Therefore, security has been a concern of all industries as companies are on war against hackers and intruders [1].
Among these, the Polybius cipher, also known as the Polybius square, is one of the commonly used methods for cryptography [35], [36]. It is one of the early cryptographic systems developed for obscuring plaintext by fractionating and substituting numbers [37]. To date, the Polybius square is still extremely valuable for cryptographers. Its ability to convert letter sequences to numeric sequences, reduce the number of different characters, and allow encoding of plaintext into two separately manipulatable units are known to be its advantages [6], [38]. Further, the Polybius square has paved the way to the development and processes of other classical ciphers that are still used today such as ADFGVX Cipher [8], [39]- [41], Bifid cipher [8], [42], Nihilist cipher [43], and Trifid cipher [44], [35]. Furthermore, modern cryptographic systems have embedded the Polybius square as a fundamental component of the cryptographic process, such as in the key generation procedures used by modern ciphers like the advance encryption standard (AES), data encryption standard (DES), and other algorithms [2], [39], [40], [45]- [50].
However, the Polybius square is a substitution cipher that is susceptible to attacks and is easy to crack with frequency analysis due to the simplicity of element distribution within its grid [51]. This problem is rooted in the structure and elements within the square grid. Therefore, there is a need to introduce a new scheme for character sequencing before performing the substitution; thus, this study. The rest of the paper is structured II. LITERATURE REVIEW Cryptography [4] is one of the widely used obscuring techniques to protect data and is commonly used in various industries [52]- [55]. Communications security is ensured through the use of ciphers whose bottleneck for an optimal implementation relies on the cipher algorithm used for encryption and decryption process. The basic ciphers are categorized into two: the substitution and transpositions. A transposition cipher transposes or reorders elements such that elements in the first place of the plaintext may be positioned in any other place of the ciphertext. Likewise, an element in the seventh place of the plaintext may be positioned in the first place of the ciphertext [10]. Meanwhile, substitution ciphers is an encoding technique where characters in the plaintext are replaced with a character or symbol or both. Ciphers such as ADFG(V)X, Alberti cipher, Autokey cipher, Caesar cipher, Four-square cipher, Polybius cipher, Enigma cipher, Freemason cipher, Kamasutra cipher, Larrabee cipher, Monoalphabetic substitution cipher, and Pollux cipher takes a letter of an alphabet and substitutes it with another character [51].
The Polybius cipher, along with other Polybius-based ciphers, is continuously being utilized along with other modern cryptographic ciphers to improve services that involve and require text security protection in digital media, such as for online shopping, internet banking, chip operation, mobile cloud computing, and mobile messaging services [56], [49], [50].

A. The Traditional Polybius Cipher
Polybius cipher, known as Polybius square, is one of the early encryption systems recorded in the history that was developed by Greek historian and a soldier, Polybius [37]. Polybius square is a substitution cipher placed in a 5x5 grid matrix where the alphabet is arranged with corresponding rows and columns without repetition. As one of the earliest ciphers developed in history, its usage was early recorded as a medium of communication and used even in wars [35].
In the Polybius square, letters in the modern English alphabet comprising of 26 characters are placed in the 5x5 grid. Individual letters are spread all throughout the 25 cells in the matrix wherein characters J and I are combined as they share the same code [57]. The Polybius square with the English alphabet is shown in Table I. Encryption and decryption using this technique are relatively easy because there is no need for a key. In encrypting plaintext, the characters are matched to the matrix one by one to retrieve their coordinates based on the intersection of row and columns. The set of coordinates generated represents the encrypted message. For example, encrypting the word CIPHER results to 1324352342, where character C is 13, I is 24, and so on. Table II shows the encryption result using the traditional Polybius square.
To decrypt a given ciphertext, the process is done in reverse. Each pair of numbers are compared to the matrix to translate the value to their corresponding plaintext form. In this case, the encrypted message 1324352342 is converted to CIPHER. Table III shows the encryption result using the traditional Polybius square.
Polybius cipher has been the basis of some of today"s encryption methods. However, the Polybius square has its identified drawbacks. The cipher does not have a key for data encryption and decryption process making it vulnerable for cracks [34], [58]. Moreover, adding the characters I and J in one cell may cause complications to the original plaintext; hence, it may confuse the decoding process [47]. The ciphertext using the Polybius square is easy to decipher as characters are always represented as a pair.
The following sections discuss the modifications and hybridization made on the Polybius Cipher.

B. A Modified Polybius Square Based Approach for Enhancing Data Security
The study of [30] introduced a 6x6 grid Polybius square to include the English alphabet and numbers. In this square matrix, the numbers are first encoded, followed by the English alphabet, as shown in Table IV.   TABLE I. POLYBIUS SQUARE WITH THE MODERN ENGLISH ALPHABET Techniques such as transposition, ring rotation, and row reversal are introduced to transmute the matrix. First, the grid performs row reversal by swapping the values in the row such that the 1 st element becomes the 5 th element, and is reciprocated. The same is applied for each remaining element in the row. For example, row 1 with elements 0|1|2|3|4|5 becomes 5|4|3|2|1 Table V shows the resulting elements' arrangement after applying row reversal.
The next process is the transposition, where values in each corresponding row are rewritten in columns. For example, row 1 with elements 5|4|3|2|1 is rewritten in column 1 with the same values. The new elements arrangement within the square grid after transposition is shown in Table VI.
Lastly, the matrix performs a rotation based on a given key. For example, with the given key as SASTRA, the key is used to retrieve the number of rotations by finding the sum of its ASCII values modulo length of the ring. Since the ASCII sum for the key is 654, the outermost ring is rotated by 14 times clockwise (654%20=14), while the second outermost ring and the inner ring is rotated 6 (654%12=6) and 2 (654%4=2) times, respectively. The grid matrix with new elements after the ring rotation is shown in Table VII. After completing the processes, every character must be identified according to their relative coordinate in the new matrix and then crosschecked with the equivalent value in the original matrix using its coordinates. For instance, the element A in the new matrix is at coordinates (5,5); therefore, the plaintext is replaced with ciphertext S based on the given value in the same position from the original matrix. Table VIII shows the encryption result of the given key SASTRA.

C. An Extended Version of the Polybius Cipher
In the quest to include symbols and numbers in the Polybius square, the 5x5 grid from the traditional Polybius square matrix was expanded into an 8x8 grid matrix. With this expansion, a wide range of characters, symbols, and numbers have been used in encrypting messages. A keyword was also introduced to adjust the character"s arrangement in the matrix. The keyword is placed on the top cells reaching the bottom and left to right cells of the grid without repetitions. Any remaining letters that are not used in the keyword are placed in the remaining cells in alphabetical order. Further, numbers are positioned in ascending order, followed by the special symbols arranged according to their ASCII value. Table IX shows how the extended Polybius square would appear using the keyword POLY2013 [47].

D. A Hybrid Polybius-Playfair Music Cipher
The paper [32] introduced a hybrid Polybius and Playfair cipher that translates plaintext into musical notes. To execute, the message is converted using Playfair digraphs and is encrypted with a key. The Polybius square with Playfair key labeled with five major music chords ABCDE is shown in Table X.
The generated ciphertext using the Playfair is re-encrypted using the Polybius square. The ciphertext is the musical equivalents of the Polybius cipher. Table XI shows how the string HELLO WORLD is encrypted using the hybrid technique. Performing the process in reverse order converts the ciphertext to the original plaintext by matching the chords with the generated matrix.

III. PROPOSED ENHANCED POLYBIUS CIPHER
In this study, the sequencing of the elements within the grid is modified. Instead of using the traditional character sequence in assigning coordinates as the ciphertext, the use of ASCII code to transmute the elements in the matrix with a secret key is introduced.
The enhanced polybius square (EPS) works by altering the arrangement of elements in the matrix based on the individual characters of a given key. For every character encrypted, a new matrix is used; therefore, similar plaintext letters may not have the same encryption value. This ensures that the ciphertext produced by the modified technique is always dynamic and more complicated to crack using frequency analysis.
The steps to encrypt a message using EPS is presented in Fig. 1, where detailed steps are as follows: a) Identify a plaintext message and a secret key. b) Each character from the secret key is paired with each of the plaintext characters. If the length of the secret key is less than the plaintext, it is paired repeatedly in a circular manner until the end of the plaintext length. c) Take character n from the plaintext and its corresponding key pair. d) Convert the key character to its ASCII decimal equivalent. e) Perform a right shift to the elements of the Polybius Square based on the ASCII decimal equivalent.
f) Generate the ciphertext equivalent of character n using the transmuted matrix.
g) Repeat steps c to f until all characters in the plaintext are converted.
The steps to decrypt a message using EPS are presented in Fig. 2, where detailed steps are as follows: a) Identify the ciphertext message and the secret key used.
b) Each character from the secret key is paired with each of the ciphertext digraphs. If the length of the secret key is less than the ciphertext, it is paired repeatedly in a circular manner until the end of the ciphertext length. c) Take digraph n from the ciphertext and its corresponding key pair. d) Convert the key character to its ASCII decimal equivalent. e) Perform a right shift to the elements of the Polybius Square based on the ASCII decimal equivalent. f) Generate the plaintext equivalent of digraph n using the transmuted matrix.
g) Repeat steps c to f until all digraphs in the ciphertext are converted. (IJACSA) International Journal of Advanced Computer Science and Applications, Vol. 11, No. 7, 2020 112 | P a g e www.ijacsa.thesai.org

A. Enhanced Polybius Square Simulation Results
In this study, a simple program was created using Python 3 and was executed in an i7-7700HQ 2.80GHz 16GB RAM 4GB RAM laptop computer. First, the plaintext and a secret key are identified. Then, the secret key is matched for every character in the plaintext and repeated based on the length of the message. Next, the ASCII decimal code value is retrieved based on each of the characters in the secret key. The ASCII values are used to perform the number of shifts in the matrix elements to generate the code equivalent for each plaintext character. For example, the message POSSESSION with the secret key CARL and its corresponding ASCII decimal codes is shown in Table XII.
The matrix is first shifted 67 cells to the right, as shown in Table XIII, to encrypt the first character of the plaintext. The process produces a new matrix wherein character P is encoded as the ciphertext 22, as presented in Table XIV. Next, the matrix is shifted again by 65 times based on the ASCII equivalent of the following secret key character A. With the new matrix, the plaintext character O is encoded as 51, as shown in Tables XV and XVI.    Plaintext  P  O  S  S  E  S  S  I  O  N   Key  C  A  R  L  C  A  R  L  C  A   ASCII  Value  67  65  82  76  67  65  82  76  67  65 Ciphertext 22 51 The process is executed repeatedly until the end of the plaintext length. After all of the matrix shifts, the final ciphertext value is now regarded as 22 51  On the other hand, the modified method produces a more varied ciphertext value, even for identical plaintext characters. As observed, no two similar characters have the same ciphertext equivalent. Also, having the same ciphertext values do not necessarily equate to being similar plaintext character. This denotes that even if the ciphertext is the same, they may not have equivalent plaintext value making frequency analysis and decryption even more confusing and complicated.
The decryption process requires access to the ciphertext and the secret key. Each character in the key is matched with every digraph in the ciphertext. This process is repeated based on the length of the encrypted message. Next, the ASCII decimal code value is retrieved based on each of the characters used in the key. The ASCII codes are used to perform the number of shifts in the matrix elements to retrieve the code equivalent for the ciphertext digraphs. The process is executed repeatedly until all digraphs are converted to their respective plaintext values. Table XIX shows the encrypted message 22  51 22 23 32 35 52 34 31 55 with the secret key CARL and its corresponding ASCII decimal codes.
As another example, the plaintext MISSISSIPPI is encrypted using the traditional and modified Polybius Square. The results are shown in Table XX. The results manifest obvious patterns for the ciphertext values generated using the traditional method wherein the repeating values 24 for I, 43 for S, and 35 for P are shown several times. However, looking closely at the ciphertext produced by the Enhanced Polybius Square, it is apparent that no two same plaintext characters are encrypted identically. For example, the character S was substituted with the values 51, 14, 52, and 22. Also, having similar ciphertext codes does not necessarily mean they have the same plaintext values, such that the ciphertext 15 was used to substitute characters I and P.

B. Evaluation Method
In order to assess the effectiveness and efficiency of the proposed method for longer texts, the execution time is www.ijacsa.thesai.org evaluated, and the frequency analysis is performed. Both modified and unmodified methods were developed and tested using the aforementioned environment.
The frequency analysis is used to predict the value of the ciphertext based on how often a character or code appears [37]. In order to test the proposed scheme through frequency analysis, a sample plaintext is first encrypted and then supplied to an online tool [59] from the website Dcode. The encrypted message is subjected to a digraphs-digits-only analysis. The following text was used for testing: "thiscourseaimstoprovideyouwithdetailedknowledgeofimp ortanttechnologiesandapplicationthatareusedintheinternetdueto thebroadnatureofthisfieldthecoursecoversonlyselectedtopicsfo cussingfirstonsomeadvancedtopicsininternettechnologiesegwir elesslansmobileinternetmulticastandthenaselectionofcurrentan dnextgenerationapplicationsandservicesegppiptvvoip"  15 24 Presented in Table XXI is the result of the frequency  analysis of the encoded text using the traditional Polybius  Square. Based on the result, the digraphs 15, 44, 24, 33, 34,  43, and 11 have the most count of repeating codes in the  encrypted text. If these values are converted using the  traditional method, the decrypted values would be E, T, I, N, O, S, A, respectively. The results adhere to the paper of [60] which discusses the top 7 most frequent letters in the Latin alphabet which are: E, A, T, I, O, N and S. This just means that a substitution cipher such as the Polybius Square is indeed prone to frequency analysis and therefore easy to break [2], [4], [34], [57].
Presented in Table XX is the result of the frequency analysis of the generated ciphertext using Enhanced Polybius Square. Based on the results, it is evident that there is minimal difference in the occurrence of each digraph. However, it can also be understood that decoding an EPS encoded message through frequency analysis may be very difficult and may take a long time since every digraphs or code can represent a number of plaintext values such that the digraphs 13 could mean any of the 25 letters depending on the series of transmutations on the matrix. Thus, making EPS not prone to frequency analysis.  With the extent to the processing time, it has been revealed that EPS has higher execution time with 0.0031s as compared to the unmodified method with 0.0005s. The results can be attributed to the fact that a new matrix is generated for every encrypted character against a static grid of the traditional Polybius Square. The simulation results are shown in Table XXIII.
With the use of the identified evaluation methods, the simulation results revealed that EPS performs better as the proposed method provides more layers of security through the use of a secret key and dynamically generated matrices. This study presents a modification on the traditional Polybius Square through cell shifting and dynamic matrix generation using a keys" ASCII code. It has been revealed that the proposed method is more secure and is difficult to break via frequency analysis. However, the increase in security comes with a tradeoff in its execution time. It is recommended that further studies may be conducted to solve this problem.