Lightweight Symmetric Encryption Algorithm for Secure Database

—Virtually all of today's organizations store their data in huge databases to retrieve, manipulate and share them in an efficient way. Due to the popularity of databases for storing important and critical data, they are becoming subject to an overwhelming range of threats, such as unauthorized access. Such a threat can result in severe financial or privacy problems, as well as other corruptions. To tackle possible threats, numerous security mechanisms have emerged to protect data housed in databases. Among the most successful database security mechanisms is database encryption. This has the potential to secure the data at rest by converting the data into a form that cannot be easily understood by unauthorized persons. algorithm has advantages and disadvantages, leaving room for optimization in different ways. This paper proposes enhancing the TSFS algorithm by extending its data set to special characters, as well as correcting its substitution and shifting steps to avoid the errors occurring during the decryption process. Experimental results demonstrate the superiority of the proposed algorithm, as it has outperformed the well-established benchmark algorithms, DES and AES, in terms of query execution time and database added size.


INTRODUCTION
The tremendous development of technology and data storage leads organizations to depend on database systems.Organizations store huge amounts of data in secured databases in order to retrieve them in a fast and secure way.Some of the stored data is considered sensitive and has to be protected.
In the presence of security threats, database security is becoming one of the most urgent challenges because much damage to data can happen if it suffers from attacks and unauthorized access.With databases in complex, multi-tiered applications, attackers may reach the information inside the database.Damage and misuse of sensitive data that is stored in a database does not only affect a single user; but possibly an entire organization [1].We can categorize the attackers into three types: intruder, insider, and administrator.Intruders are external people who infiltrate a database server to steal or tamper with data.Insiders are authorized users in a database system, who conduct some malicious works.Administrators can be database administrators (DBA) or system administrators (SA), and both have absolute rights to database systems.However, if they are malicious, the security of the database may be damaged [2].Insider and administrator attackers have gathered more attention in recent years because they can access a database without any effort, and they use important data in a wrong way.Database encryption has the potential to secure data at rest by providing data encryption, especially for sensitive data, avoiding the risks such as misuse of the data [1].In order to achieve a high level of security, the complexity of encryption algorithms should be increased with minimal damage to database efficiency, ensuring performance is not affected.
There are many research studies in the database security field.Some of them have efficient implementations.Also, many encryption algorithms have been proposed, some of which have appealing features but still need further development, one such algorithm is the Transposition, Substitution, Folding and Shifting TSFS algorithm, known as the TSFS algorithm [1].The TSFS algorithm provides a high degree of security, using a number of features.However, it supports only numbers and alphabetic characters that are not enough to protect different types of sensitive data.Another deficit of the TSFS algorithm is during the substitution and shifting processes where some errors occur during the decryption process.
This paper provides a secure and efficient encryption method that encrypts only sensitive data without using special hardware.It enhances TSFS algorithm by extending its data set to special characters, and corrects substitution and shifting processes, by providing more than one modulo factor and four 16-arrays respectively in order to avoid the error that occurs during the decryption steps.Moreover, this paper draws a comparison between the enhanced TSFS algorithm (ETSFS) and two other famous encryption algorithms, namely Data Encryption Standard (DES) and Advanced Encryption Standard (AES) algorithms, and evaluates their performance in terms of query execution time and database added size.
The remaining parts of this paper are organized as follows: section 2 reviews existing work on database encryption techniques.Section 3 introduces the ETSFS algorithm and explains its procedure, while section 4 introduces the implementation of the ETSFS algorithm and suggested structure.Section 5 presents a comparative study between the algorithms, evaluates performance, reports results and www.ijacsa.thesai.orgdiscusses them.Finally, section 6 concludes with a summary of contributions and makes suggestions for future research work.

II. RELATED WORK
Due to the important role that encryption techniques play in securing database systems, numerous algorithms have emerged with different techniques and performance.Bouganim and Pucheral proposed a smart card solution to protect data privacy; the owners of databases can access the data using a client terminal that is supported by smart card devices [3].This proposed solution is considered as a secure and an effective solution, but it is complicated and expensive [1].Database encryption greatly affects database performance because each time a query runs, a large amount of data must be decrypted.Therefore, [4] suggests that encrypting sensitive data only can provide the needed security without affecting the performance.
In [1] [5] [6] encryption algorithms were proposed depending on encryption of sensitive data only.Kaur et al. proposed a technique to encrypt numeric data only using a fixed data field type and length [5].However, this algorithm does not support encryption of character data.Agrawal et al [6] also, proposed an encryption scheme for numeric data with an important feature that allows queries or any comparison operations to be applied directly on encrypted data sets without decrypting them.The scheme uses indexes of database over encrypted tables, but it is only applied to numeric data, additionally, it has not investigated key management.In some application, where the data is backed up frequently, we need to control the access to data and support multilevel access.So, Hwang and Yangb proposed a multilevel database encryption system with subkeys, which can encrypt/decrypt the whole table, column or row.Also, this system can encrypt each row with different subkeys according to a security class of the data element.This system is based on the Chinese Remainder Theorem [7].
The DES algorithm is one of the famous encryption algorithms that uses a symmetric-key to change 64-bit of a plain text into 64-bit of a cipher text, using 56-bit of the key and 16 rounds.[8].It is, now, considered as insecure for many applications; this is mainly due to the size of key, which is too small [9].The work in [10] presents the AES algorithm as a replacement for the DES algorithm as a standard for data encryption.It is a symmetric-key algorithm that takes 128-bit for the plain text and 128, 192, or 256-bit for the key, the length of the key specifies the number of rounds in the algorithm.
Finally, Manivannan and Sujarani [1] proposed efficient database encryption techniques using the TSFS algorithm, which is a symmetric-key algorithm.Its main features include using transposition and substitution ciphers techniques that are important in modern symmetric algorithms as they have diffusion and confusion.Also, it encrypts only the sensitive data, so, it limits the added time for encryption and decryption operations.The algorithm utilizes three keys and expands them into twelve subkeys using the key expansion technique to provide effective security for the database.In order to improve the security, this algorithm uses twelve rounds and two different keys in each round.
However, TSFS algorithm applies only to alphanumeric characters; it does not accept special characters or symbols.More details about the TSFS algorithm is provided in [11], which builds a system that generates different numbers of secret keys based on the TSFS algorithm along with other algorithms to ensure a high security level of encrypted data.

III. PROPSED ALGORITHM (ETSFS)
The main objective of this paper is to enhance the TSFS algorithm [1] and accordingly to provide a high security to the databases whilst limiting the added time cost for encryption and decryption by encrypting sensitive data only.The ETSFS algorithm can encrypt the data that consists of alphabetic characters from A to Z, all numbers and the following symbols: ( *, -, ., /, :, @ and _ ).The ETSFS algorithm is a symmetric encryption algorithm, meaning each transformation or process must be invertible and have inverse operation that can cancel its effect.The key also must be used in inverse order.ETSFS algorithm uses four techniques of transformations, which are transposition, substitution, folding and shifting.Fig. 1 presents the encryption algorithm, where the decryption algorithm reverses the encryption algorithm.The following sections describe the four techniques and contain the algorithms in pseudo-code format to be easy to understand:

A. Transposition
Transposition transformation changes the location of the data matrix elements by using diagonal transposition that reads the data matrix in the route of zigzag diagonal starting from the upper left corner after getting the data and pads it with *s if it is less than 16 digits [1].Fig. 2 shows the transposition process when the entered data was: 6923@domain.Sa, where Fig. 3 shows the transposition algorithm in encryption side, then, Fig. 4 shows the transposition algorithm in decryption side.

B. Substitution
The second algorithm is substitution transformation.It replaces one data matrix element with another by applying certain function [1].If the element represents an alphabetic character, it then will be replaced with another character.If the element represents a number, it will be replaced with a number, and if it represents a symbol, it will be replaced with a symbol.The encryption function [1] E for any given letter x is Where p is the plain matrix element, k1 and k2 are the keys elements that have the same position of p, and M represents the size of modulo operation.The ETSFS algorithm takes three values for the modulus size instead of one value as in the TSFS algorithm.The described substitution process in [1] has confusion.Confusion happens if the data is composed of alphabetic and numeric digits, and the modulus size (M) will be 26 for any digit, as illustrated in the next example.If one element in the data was 4, k1=5, k2=5, M = 26, then the result of substitution process is 14 as the paper presents.This result causes two problems.The first problem, is that the length of the data will be changed and increased; for example, when the plan text size is 16 digits, the cipher text size will be 17 digits if one element only changes, and that contradicts the TSFS algorithm's feature.The second problem, since the inverse operation decrypts the data digit by digit also, is that then it will deal with each element in the cipher text individually (1 then 4).As a result, the decrypted data will be different from the data that have been encrypted.Therefore, the ETSFS algorithm gives M the following values: 26 if p is aliphatic, 10 if p is numerical and 7 if p is symbolic.The decryption function [1] D is: Since most of the programming languages such as Java and C++ deal with the modulus as the remainder of an integer division, some of the results may have minus sign, and this will create a problem because there is no data that have minus sign representation.So, one more step has been added to the ETSFS algorithm implementation to check if the result includes the minus sign, and then apply:

D(E(x)) = M -|D(E(x))|
(3) The following Fig. 5 shows the result of substitution.From the same example in fig.5, if we implemented the decryption operation (2) on the first element, the result would be -4, so the ETSFS algorithm applies function (3) to get the correct result, which is 6.Fig. 6 and 7 show the substitution encryption algorithm and its inverse respectively.

C. Folding
The third algorithm is folding transformation.It shuffles one of the data matrix elements with another in the same entered data, like a paper fold.The data matrix is folded horizontally, vertically and diagonally [1].The horizontal folding is done by exchanging the first row with the last row.The vertical one is done by exchanging the first column with the last column.The diagonal fold is done by exchanging the inner cells, the upper-left cell with the down-right cell and the upper-right cell with the down-left cell.Fig. 8 shows the example after folding, while Fig. 9 shows the folding encryption algorithm.Next, Fig. 10 shows the folding decryption algorithm.

D. Shifting
The last part of the algorithm is the shifting transformation, which provides a simple way to encrypt using a 16-array element of numeric digits to exchange a letter with another.Each element of the array must contain the numeric representation of the data.Each digit must appear only once in Algorithm inverseFolding (Matrix data) Pre: data is 4x4 matrix of data get from inverse substitution technique.Post: data is data matrix after applying inverse folding technique.

End inverseFolding
Algorithm folding (Matrix data) Pre: data is 4x4 matrix of data get from substitution technique.Post: data is data matrix after applying folding technique.
Matrix temp; temp[0,0] = data [3,3]; End substitution www.ijacsa.thesai.org each element of the array.The digits can appear in any order [1].In shifting process, the algorithm replaces each element in the data matrix by its position within its array element.The ETSFS algorithm uses four 16-arrays instead of one array as the TSFS algorithm uses, because the described shifting process in [1] has confusion.For example, if an element in the plain text is 4 and its position within the array is 15, then the shifting process in [1] returns 15, which is causing the same two problems that were described in substitution transformation.So, the ETSFS algorithm separates each type from other.The ETSFS algorithm uses four 16-arrays, one for numeric, one for symbols, but because it is difficult to enumerate all symbols in this project; the suggested ETSFS algorithm considers only two types of symbols.Symbols that are used in emails (-, ., @, _) and symbols that are used in IP addresses (/, :).The last two 16-arrays are used for alphabetic, where one for capital letters and the other for small letters.We used that to enhance TSFS algorithm and make it is sensitive for the type of letter.The process illustrated in Fig. 11.Fig. 12 and 13 show the shifting encryption algorithm and its inverse respectively.
The previous encryption process is considered as the result of the first round of the ETSFS algorithm.The output of the first round goes as an input to the second round and the output the second round goes as an input to the third round.This process continues up to the 12th round and the output of this round is the cipher text of the given plain text and that cipher text is stored in the database.For keys, in each round, it selects two keys for encryption.In encryption, each round (i) selects the key (i) and the key (i+1), at round 12 it selects key (12) and key (1).In decryption, the keys are selected in reverse order.The Fig. 14 shows the steps of expand keys as [1] suggested.

IV. IMPLEMENTATION
A Java-based project has been built to test the ETSFS algorithm correctness and performance.The implementation uses three-tier architecture, as represented in Fig. 15.The threetier separate the functions into interface, processing and data management functions.The multi-tier architecture allows developers to create flexible and reusable applications.In addition, this architecture provides "encryption as a service" to facilitate the interaction between the interface and the encryption/decryption model, and makes the process of encryption or decryption transparent to application [2].In this paper, the interface-tire is used to enter and retrieve data from the database.The processing-tier is used to garner the data or query from the interface-tier and then to complete the encryption or decryption processes to apply the query over the secure database.It stores the keys in a separate file instead of storing them in the database to increase the security.Finally, a data management-tire stores the data.
Depending on the suggested architecture, the implementation structure was developed as shown in Fig. 16.This Figure illustrates all classes and their connections with each other.It shows the attributes of each class and functions headers.The classes include:

A. Maic Class
In general, at the beginning, the user can enter the information that will be encrypted.In this implementation, the main class reads data from a file to obtain equivalent results when measuring the performance.The interface part is responsible for taking the data from file and sending it to the translator part to save it in the database.Another function for the interface is to retrieve the data form the database by using the translator part.

B. Translator Class
The middle part contains three parts.One part is used for keys; the other one, which is the translator, is used to deal with the database, and the last part is used for encryption/decryption operations.During the experiment, the translator class receives the data from the interface part by the SaveInDatabase() method, and draws a connection with the database so as to apply insert query in the database after encrypting the received data.Here the function depended on the application and the table used in the database.We used one table named "person".It contains four columns: name, phone, mail and job.The first three columns contained sensitive data.So, SaveInDatabase() method receives four data and encrypts the first three data by using the encryption/decryption (ED) class, then applies the insert query to add this data into the database.Also, the translator has another method used to apply the select query from the database.In this project, we focused only on the encryption/decryption algorithms rather than how the query should be translated or mapped to a query that can be applied on the encrypted database.So, we just two direct specific select queries for selecting the data, one for retrieving the complete table and the other for selecting a query depending on a condition which is the information of a person how has specific name.After retrieving the data from the database, the translator class decrypts it by using the ED class, and then printed it in the screen.In the second query, before the method does select operation from the database, this method must encrypt the data that is used in the condition by using the ED class to do the comparison operations over encrypted data.

C. Encryption/Decryption Class
This class is the most important class for this work.After the ED class receives the data from the translator class, it checks on some of points.It checks the length.The length must be equal to 16; if it is less than 16, the ED class pads the data with (*) symbol up to 16 digits.In this project, we choose the (*) symbol for padding because it is not used in the data.If it is more than 16, the ED class deducts of the excess.After that, the ED class changes the data form to 4x4 array form to apply the algorithm on an array form.Then the ED class applies the same following scenario twelve times.First, it applies transposition transformation and changes the location of the elements in 4x4 data array by using diagonal transposition, and the result array of this step considers as input to the second step.In the second step, the ED class applies substitution transformation and replaces one data with another by using two keys in each round.Each element in the data array is one of three types: number, alphabet or symbol, and each of them has different modulo.If the element is alphabet or symbol, first it changes to a number based on the position in the alphabets a-z (a-0, b-1, ... z-25), then the ED class applies the equation of encryption on this number.We selected the symbols' positions as following (*, -, ., /, :, @, _) depended on precedence in ASCII codes.The result array of this step considers as input for the third step.In the third step, the ED class applies folding transformation and shuffles each element in 4x4 data array with another one in the same array, and the result array of this step considers as input for the fourth step.Fourth step, the ED class applies shifting transformation and replaces each digit of data array by its position within its array element.Each element in the data array is one of three types: number, alphabet or symbol, and each of them have different arrays set.There are four defined 16-arrays, one for numeric, two for alphabetic where one for capital letter and other one for small letter and last array for symbols.If the element in the data array is alphabet or symbol, first the ED class changes the element into a number based on the position in the alphabets a-z (a-0, b-1, ... z-25), then the ED class replaces the number with its position within its array set.The result array of this step considers as input for the first step again in the next round.After the twelve rounds finish and the data encrypted, the ED class sends the result to the translator part to store it in the database.
Also, the ED class has other function is responsible of decryption operations.This function receives the encrypted data from the translator part.The ED class first prepares the data into 4x4 array form to apply the algorithm on array form.After that, it sends the data array to the decryption methods in reverse sequence, started with inverse shifting, inverse folding, inverse substitution then inverse transposition.All of these methods follow the same scenario that applies in encrypted part but with inverse operations.This scenario also applies twelve times, the output of the each round considered as input to the second round.After the twelve rounds finish and the data decrypted, the ED class sends the result to the translator class.

D. Key Class
Key class reads three initial keys from the file.Then it checks on some points.Checking on the length, the length must be equal to 16.If it is less than 16, key class pads the key with 0s.If it is more than 16, key class deducts off excess.Then key class converts all digit of the keys to numbers based on position in the alphabets a-z (a-0, b-1, ... z-25).After that, it changes the keys form to 4x4 array form to apply the operations on array form.www.ijacsa.thesai.orgAfter that, the keys are expanded based on shifting the rows into twelve keys, where each key is expanded into four keys.Each output key is stored in 4x4 array form, and the expanding technique implements as the following: the first output key has four rows where row 0 is not shifted, row 1 is shifted by one time, row 2 is shifted two times and row 3 is shifted three times.In the second output key, row 0 is shifted one time, row 1 is shifted 2 times, row 2 is shifted three times, and row 3 is not shifted.In third output key, are row 0 is shifted two times, row 1 is shifted three times, row 2 is not shifted and row 3 is shifted one time.In the last output key, row 0 is shifted three times, row 1 is not shifted, row 2 is shifted one time and row 3 is shifted two times.

V. COMPARATIVE STUDY
This section presents a comparative study between the DES algorithm, the AES algorithm and the ETSFS algorithms.It explains the experiment in order to evaluate their performance to establish the best algorithm amongst all possible algorithms.It then reports the results and discusses them.
The DES algorithm uses too short key length.Within the rapid advances, DES is breakable, for example in 1998 the Electronic Frontier Foundation built a DES Cracker for less than $250,000 that can decode DES messages in less than a week [12].The AES algorithm is used as a standard for data encryption.It is stronger and faster than the DES algorithm [13].DES and AES algorithms have open source code, and they are supported by Java libraries.

A. Experiment Setup
The experiment compared the ETSFS algorithm with the DES and AES algorithms, which have open source code.To test the algorithms, the following materials were used:  Programming language: Java.
 Java external Library: Connector-java 5.1.23-bin.jar to connect the java with MySQL server.
 Visual database design tool: MySQL Workbench 5.2 CE used for database design, modeling and SQL development.
 Operating system: Windows Vista Home Premium, 32bit.
In the experiment, to obtain fixed and fair comparison between the algorithms, same entered data and same functions that are responsible for accessing the database were used in all algorithms.Furthermore, each algorithm was tested with the following data size: 100, 500, 1000, 1500 and 2000 rows.For each size, the experiment was repeated three times and then the average value for each timer was calculated to eliminate the effect of the computer processing issues and insure near fair real value.

B. Evaluation Metrics
Execution time (Second): The evaluation performance of encryption/decryption processes conducted in terms of the execution time of insert and select SQL queries.In this project, we followed the same approach presented in [14] to calculate the execution time.We used a timer to calculate the execution time of the query from the beginning of its work until it finishes successfully.Three timers were used in each algorithm to calculate the execution times for three types of quires:  Select all: To know how much time does the query take to select all the rows and decrypt the encrypted fields with decryption processes.Select all query example: SELECT name, phone, mail, job FROM person.
 Select with condition: To know how much time the query takes to encrypt the data in the condition, then compare this data with the encrypted data inside the database to retrieve the required data, and decrypt the encrypted selected fields with decryption processes.Select with condition query example: SELECT name, phone, mail, job FROM person WHERE name = encrypted name.
1) Database size (Kilobyte): One of the most important factors to determine about the database is its overall size [15].So, we used the database size criterion to compare the database sizes between the three algorithms after storing the encrypted data.We used it to know the impact of the encryption process on the database overall size.

C. Results and Discussion
In this section, we stated the results of our experiments in terms of execution time and database size aspects.For each criterion, we presented the average values for each one of the three different algorithms with different sizes of data.Also, we interpreted the findings and results, and showed the relationships among the algorithms.

1) Execution time:
 Insert queries execution time: First, Fig. 17 shows the relationship between encryption time during insertion the data in the database and the number of tuples for each algorithm.In general, when the size of data increases, the time also increases.From the results, it is obvious that the AES algorithm consumes the longest time for encrypting and the ETSFS algorithm consumes the least time for that.The speed of the AES encryption depends on the number of rounds and the key generation in each time it does the encrypt function.Also, each round in the AES algorithm needs round key from the key expansion algorithm.So the AES algorithm depends on the speed of the round key www.ijacsa.thesai.org generation [16].In contrast, the ETSFS algorithm needs the key generation only one time before doing the encrypt function.That is mean the ETSFS algorithm has the best execution performance when applying insert queries that include encryption processes.
 Select all query execution time and select with condition quires execution time: Fig. 18 shows the relationship between decryption time during searching in database with using a query to retrieve the complete table and the number of tuples, and Fig. 19 shows the relationship between decryption time but with using the queries that depend on a condition and the number of tuples for each algorithm.The DES algorithm consumes least time when applying the select queries.The instability of the relationship may occur owing to the time taken in connecting and disconnecting the database or file operations.Moreover, hardware issues may cause inconsistent relations.The AES algorithm consumes more time than the ETSFS algorithm for selecting queries because in the AES algorithm, the decryption module depends mainly on the key expansion module [16].Also, the execution of the query that retrieves the complete table consumes little more time than those that depend on the condition because the former retrieves more tuples than the latter; this tuples need more decryption operations.
2) Database Size: In term of storage, Fig. 20 shows the relationships between the number of tuples and the size of the database in kilobyte after storing the encrypted data with the use of the three algorithms with different data sizes.Where the data size increases, the difference is evident between the algorithms.The results show that the ETSFS algorithm has consumed the smallest space among other algorithms.This happened because the size of the encrypted data in ETSFS algorithm does not increase more so than the original size; rather, it keeps the size as it is.However, AES and DES algorithms extend the data size to multiple of 128-bit and 64-bit respectively [12].The AES algorithm needs largest storage space to store the data, followed by DES algorithm, which needs larger storage space than the ETSFS algorithm.The experiment proves that the ETSFS algorithm can secure the data successfully when the data sets of the ETSFS algorithm are increased, and also that the substitution and shifting techniques are corrected.The insert queries execution time is not affected because the algorithm encrypts the sensitive data only, and the database size is not affected because the algorithm does not increase the size of encrypted data.In general, the improved performance comes without compromising query processing time or database size.

VI. CONCLUSION AND FUTURE WORK
Data-storing and exchanging between computers is growing fast across the world.The security of this data has become an important issue for the world.The best solution centred on securing the data is using cryptography, along with other methods.This paper proposes the enhancement of the TSFS algorithm to support the encryption of special characters, correct substitution process by providing more than one modulo factor to differentiate between data types and prevent increasing the data size, as well as correcting the shifting process for the same reasons by providing four 16-arrays.The experimental results shown that the ETSFS algorithm successfully encrypted important symbols, as well as alphanumeric data.The improved performance comes without compromising query processing time or database size.Using well-established encryption algorithms as benchmarks, such as DES and AES, the proposed ETSFS algorithm was shown to have consumed the smallest space and encryption time compared to the other algorithms.
Due to time constraints, it was difficult to cover all special symbols in this paper; however, the ETSFS algorithm can be extended to include other symbols with slight modification to the encryption/decryption processes.For future work, it is intended that this algorithm be improved so as to accommodate any size of data, rather than only 16 digits.Furthermore, it is intended to further evaluate the security of ETSFS algorithm by establishing the number of operations and the time attackers need to recover the keys and accordingly hack the encrypted data.


Insert: We calculated the insertion execution time to know how much time does the insertion operation consumes with encryption processes.Insert query example: INSERT INTO person VALUES (encrypted name, encrypted phone, encrypted mail, job).

Fig. 17
Fig. 17.The relationship between the insert operations execution time and the number of inserted rows for the three algorithms.
Fig. 17.The relationship between the insert operations execution time and the number of inserted rows for the three algorithms.

Fig. 18 .
Fig.18.The relationship between the execution time of select all rows operation and the number of rows for the three algorithms.

Fig. 19 .
Fig.19.The relationship between the execution time of select operations that depend on condition and the number of rows in the database for the three algorithms.

Algorithm encryption (String data, Array[12] keys ) Pre: data is plain text. keys is array that contains 12 4x4-key matrices. Post: encryptedData is data after encrypting.
End encryption www.ijacsa.thesai.org

End inverseSubstitution Algorithm substitution (Matrix data, Matrix key1, Matrix key2) Pre: data
data is 4x4 matrix of data get from inverse Transposition technique.key1and key2 4x4 matrix used to decrypt data.Post: data is data after retrieving changes. is 4x4 matrix.key1and key2 are 4x4 matrix used to encrypt data.Post: data is data after applying substitution encryption method.