Optimizing Digital Image Steganography to Enhance the Security of Secret Message Delivery

: Image steganography is a technique used to hide secret messages in image media. In this research, 2 method improvements are proposed, namely (1) layered message security utilizing vigenere encryption with asymmetric keys, and (2) optimizing the hiding capacity (HC) of secret messages, utilizing the bit shift operation method. From the test results it can be proven that layered message security has been successfully implemented, and the capacity of secret messages can be increased. From the initial 4 bits per pixel it increased to 8 bits per pixel. However, the steganography image quality of the proposed method is not better than the PVDMF method.


Introduction
Steganography is a technique used to conceal secret messages within seemingly ordinary media, such as images.The significance of images in steganography lies in their visual nature, allowing secret messages to be embedded without attracting the attention of others (Jain, 2020).Research in this field holds great importance due to the increasing need for secure communication.Through the use of image steganography, secret messages can be embedded into images, appearing as ordinary pictures without arousing suspicion of the message's presence.This is crucial in various contexts, such as data security, communication privacy, and criminal investigations (Mandal, 2019).The military's utilization of steganography is To increase the security of this encryption key, there has been other research that uses the approach of using two keys, one in the form of a normal string and the other based on insertion time (Wijaya, 2023).However, there is still a weakness, namely that the encryption key in the encryption key distribution process is in the form of a normal string.This distribution of encryption keys in the form of normal strings can be improved by combining On time Pad (OTP) with Message Digest 5 (MD5).Where improvements to this method have been proven to be able to be implemented for classic Vigenere encryption (Putra, 2023).Even though these two studies are better than before, they still have problems, namely the encryption key distribution mechanism.The fundamental weakness of these two methods is that the encryption key is still a symmetric key.
Based on the summary of existing research, the research problem (RP) that can be described is as follows: • RP1.To further secure secret messages inserted into images, classic encryption can be applied, namely Vigenere cipher.This substitution encryption technique is effective when combined with steganography, because ciphertext encryption does not change the number of characters that will be inserted into the cover image.However, for most substitution encryption, including Vigenere, the encryption key is of the symmetric key type.The fundamental weakness of symmetric keys is the security factor when distributing the encryption key itself.
• RP2.If you use the LSB steganography technique, the character capacity that can be inserted into the image is not large, because it only uses the last 1 bit of the vessel image.
However, if the pixel value difference and modulus function (PVDMF) approach is applied, the number of bits that can be accommodated is only 4 bits per pixel (BPP).
From these two research problems, the research questions (RQ) that can be explained are as follows: • RQ1.How to create asymmetric keys (private key and public key) to apply to Vigenere encryption (text substitution ecryption)?
• RQ2.How to develop a bit shifting operation algorithm that can maximize the capacity of characters to be inserted into the cover image?
• RQ3.How is the quality of the steganography image after applying the bit modification algorithm?
To answer research question number 1 (RQ1), researchers will apply a combination of several methods to produce asymmetric keys that will be applied to substitution text encryption.Lempel-Ziv-Welch (LZW) encoding, and (6) processing secret message encryption using the key resulting from method number 4. Henceforth the result of method number 4 or the result of the hash is called the private key.Meanwhile, the result of method number 5 is called the public key.
Meanwhile, to answer research question number 2 (RQ2), researchers will apply a bit modification method which consists of 2 steps, namely (1) bit masking operation, (2) bit injection using AND and OR operations.
Finally, to answer research question number 3 (RQ3), researchers will measure image quality by (1) analyzing Histogram Equalization, (2) comparing the Peak Signal-to-Noise Ratio (PNSR) between the cover image and the steganography image.

Research Method
In

Figure 2 Class Diagram of Steganography System
A detailed explanation of each step in the first research contribution can be seen in the following discussion.
Stage 1 : Generating the On Time Password (OTP) In stage 1, the system automatically generates 4 digit numbers randomly.The aim of implementing this method is that the encryption key always changes every time the encryption process is carried out.The mathematical equation at stage 1 looks like the formula for equation 1 below.Where OTP is data in the form of a string consisting of 4 characters.This OTP is the original key, which will later be modified to become a private key and a public key.
Stage 2 : Calculate the Least Common Multiple (LCM) from OTP The aim of stage 2 is to modify the OTP to produce numbers that are not the same as the OTP results.Next, the results of stage 2 will be used to form a private key, which will be implemented in substitution encryption.The mathematical equation at stage 2 looks like the formula for equation 2 below.In stage 3, this is the stage for forming the actual private key, where this private key will later be used in the encryption stage.To further secure this private key, the mechanism applied is to randomize (hash) the results of the process in step 2. To randomize (hash) in this research the Secure Hash Algorithm version 1 (SHA-1) method is used.The researcher did not discuss the SHA1 process flow in detail, because the researcher utilized the SHA-1 function which is available in Request For Comments (RFC) 3174 (Eastlake, 2001).The mathematical equation at stage 3 looks like the formula for equation 3 below.
Message padding a) The input message is padded to a form that can be processed, typically by adding padding and information about the message length 3.
Message Block Splitting: a) The padded message is split into smaller blocks, usually 512 bits each.4.
Message Block Expansion: a) Each message block is expanded into 80 words of 32 bits. 5.
Message Block Processing: a) Involves a series of bitwise logical operations, bit rotations, and non-linear functions.7.
Updating Hash Values: a) After processing each message block, the values of  0 ,  1 ,  2 ,  3 ,  4 are updated with the results of the processing.8. Iteration: a) The processing of message blocks is iterated until the entire message is processed.
(3) Sengkalan is a culture that originates from the people of the island of Java, Indonesia.
Sengkalan expressions are forms of expressions of Javanese society.The definition of sengkalan is sentences and words that have the character of numbers.From these sentences or words, year numbers are composed as written on the gate of the house or cemetery (Adi, 2014).Examples of characterizing numbers into the word sengkalan are as shown in Table 1 below.Anggusti, Astha, Bajul, Basu, Basuki, etc. 9 Ambuka, Anggangsir, Angleng, Angrong, Arum, etc.
An example of a sengkalan sentence is "Sirna Ilang Kartaning Bumi", if translated literally the meaning is "The prosperity of the earth has disappeared."But the real meaning is not that.
The meaning according to the science of sengkalan is that "Sirna" is the symbol for the number 0, "ilang" is the symbol for the number 0, "kartaning" or "karta" is the symbol for the number 4, and "bumi" (earth) is the symbol for the number 1.When arranged, the numbers become 0041.If read from back to front, it becomes the number 1,400.This figure indicates the year 1,400 Saka or 1.478 AD (Adi, 2014).
In this research, the Sengkalan rule is used to show the character of the On Time Password.
By adding the contribution of combining Sengkalan with On Time Password, a public key can be generated that is different from the private key.On this basis, to encode the Sengkalan method into a public key encryption security system, it can be described in a mathematical equation such as equation 4 below.For the purposes of the decryption process, this The sentence "sengkalan" can actually indicate a public key which will later be translated into a private key which is the same as the key to encrypt a secret message.However, if the sentence is shared as is, it is feared that other people will easily guess it.Moreover, if someone understands Javanese literary vocabulary, then that person will definitely know the true meaning of the sengkalan sentence.For security reasons, the distribution of the "sengkalan" sentence (public key) needs to be engineered first.For this reason, in this study the sentence "sengkalan" needs to be encoded first.Later the encoded results will be distributed.In this research, the type of encode chosen is the Lempel-Ziv-Welch (LZW) method (Krokosz, 2023).
The Lempel-Ziv-Welch (LZW) encoding algorithm can be mathematically represented in equation 5 below.
Initialize D as a dictionary with single ASCII characters (0-255) as the initial dictionary.

2.
Initialize p with the first character of s.

3.
For each yet-to-be-processed character c in s : a) If p+c is present in the dictionary: i. Update p to p+c.

b) If not:
i.
Output the dictionary index of p.
ii. Add p+c to the dictionary.
iii.Update p to c.
4. Output the dictionary index of p.
(5) The Lempel-Ziv-Welch (LZW) decoding algorithm can be represented mathematically as seen in equation 6 below.
Initialize D as a dictionary with single ASCII characters (0-255) as the initial dictionary.

2.
Initialize s with the first character of encoded_output

3.
Initialize p with the first character of encoded_output.

4.
For each index k in encoded_output(starting from the second index): The mathematical equation for this encryption process looks like equation 6 below.

Optimization of the LSB using Bit Shifting Operation
In the PVDMF method the number of modified bits is only 3 bit per pixel, where the modified bits are in the colors Red, Green and Blue.Meanwhile, for the improved method proposed in this research, the number of modified bits is 8 bits per pixel.The modified bits in the proposed method are in the colors Red, Gren, Blue and Alpha.To get a complete picture of the differences between these two methods, you can look at Figure 3   ii

4.
Result : a) img = Convert from array pixel 1D to array 3D The hidden message data format looks like Figure 4 below Extract 8 digit of bit to ASCII :

Result and Discussion
The proposed research is implemented in the Javascript language (ECMAScript 6).The source code can be accessed at this URL address: https://github.com/ekoheri/Optimizing_Steganography.The program in this research supports Graphical User Interface (GUI).The experimental study was carried out in four stages using a GUI.These steps are given as follows.
1. Cover Image: In this stage, the cover image is uploaded from the camera or file by using the GUI.
2. Secret message : The user uploads the message that he wants to hide in the cover image by manual.
3. Encryption and Decryption : In this phase, the secret message is encrypted using text substitution with a private key, while the decryption process uses a public key.The use of different keys is then called asymmetric encryption.
4. Hide data by shifting the LSB bit: In this phase, the encrypted secret message is inserted into the cover image.
5. Analysis: This section provides data analysis about the stego image.The PSNR value (Hore, 2010) is calculated to measure the quality of the stego image compared to the cover image.The PSNR value calculation is given in Equation 10.Where the encryption process uses a private key, while the key distributed is a public key.
However, the test results also show evidence that users do not need to share the public key.
Because the public key is in the message hidden in the image.This is the second advantage of this research.If in previous research, one of the weaknesses of encryption with symmetric keys was the distribution of the encryption key (Subandi, 2017), then in this research, the weakness in the distribution of the encryption key was proven to be correctable.Where the method is improved is to provide an asymmetric encryption key.

Hide Data by Shifting the LSB bit
The contribution to this research also succeeded in answering research question 2 (RQ2), namely how to develop a bit modification algorithm that can maximize the capacity of characters to be inserted into the cover image?If in previous research the capacity was able to increase by 3,1 bits per pixels (Sahu, 2019), and 4 bits per pixels (Darwis, 2020).Then in this research the capacity can be to 8 bits per pixel (1 byte per pixel).So if in previous research, 2 pixels were needed to insert 1 character (8 bits), then in this research 1 character (8 bits) can be inserted into 1 pixel (8 bits per pixel).A comparison of the number of pixels that change when using the PVDMF (Darwis, 2020) methods with the proposed method is shown in Figure 12  Based on the description above, the contribution of this research has succeeded in correcting the weaknesses of previous studies.The first improvement is to successfully apply a layered security method to the secret message inserted into the cover image.In previous research (Zakaria, 2018), this layered security method had not been implemented.The second improvement is to successfully apply asymmetric keys to the text substitution encryption method.Where in previous research (Wibowo, 2022), a symmetric encryption key security system was still implemented.Meanwhile, the third improvement was successful in increasing the capacity of bits per pixel.If in previous research it was only possible to insert 4 bits per pixel (Darwis, 2020), then in this research it can be increased to 8 bits per pixel (1 byte per pixel).
However, this research also still has weaknesses.The first weakness is that the number of characters inserted into the image increases, because the characters inserted are the public key encoding, plus the encryption (ciphertext) of the secret message.If the initial number of secret message letters is only 16 bytes, then when you add the public key it will increase to 89 bytes.

Image Quality Analysis
From the results of four trials as in Figures 7, 8, 10 and 11, different hidden message data (public key and ciphertext) were obtained, even though the input data was the same.When the message is inserted into the cover image, the quality of the steganography image is not the same.This is proven by the PNSR test on the two steganography images, as shown in table 2 below.
this discussion topic, researchers present two types of research contributions: (1) the implementation of text substitution (vigenere) encryption equipped with asymmetric keys, and (2) the optimization of the LSB bit shifting operation to accommodate a larger number of characters compared to the LSB with PVDMF method.The overall method flow in this research is illustrated in Figure 1 below.

Figure 1
Figure 1 Model of steganography systemIn accordance with the system flow as previously explained, the system design developed in this research, follows the following class diagram flow.The explanation of the class diagram can be seen in Figure2below.
Generating a hash from the Result of Least Common Multiple (LCM)

Figure 3
Figure 3 Comparison of PVDMF Methods with Proposed MethodsTo implement this steganography method, researchers apply a bit modification method which consists of 2 steps, namely (1) bit masking operation, (2) bit injection using AND and OR operations.The first step, namely the bit shift operation, aims to shift the secret message bits so that their position matches the desired color location.The next step is to insert the secret message bit into the cover image.For this insertion, researchers utilized AND and OR logical operations.The mathematical equation for this encoding process looks like equation 8 below.1. Initialization : a) img = read image from cover image b) pixel = Convert from image array 3D to array 1D 2. Convert Message Length to Hexadecimal Format : a) data_length = format(len(secret_message),′06h′) b) decimal_msg = encode_utf8(data_length + secret message) 3. Insert Message into Pixel: For i in 0 ≤  < ℎ(_) a) Masking bit Operation :

Figure 4 the
Figure 4 the Hidden Message Data FormatTo extract secret messages from images, researchers applied the AND operation method and shifted the bits from the Alpha, blue, green and red pixels.The mathematical equation for this encoding process looks like equation 9 below.1. Initialization : a) img = read image from stego image b) pixel = Convert from image array 3D to array 1D c) i = 0, completed=false, hidden_msg = empty string, exctract_bit = 0, number_of_hidden_msg = 0 2. Extract bit into String Hidden Message: ℎ ( < ℎ()   = ) a) Get 2 digit of bit LSB from Pixel Alpha-Blue-Green-Red :

Figure 6
Figure 5 presents these images used in experimental studies.In Figure 6, a sample image of the GUI Steganography is presented.

Figure 7
Figure 7 First Trial ResultsNext, the researcher repeated the testing process again with the same data input as the first test.The test results look like Figure8below.

Figure 8
Figure 8 Second Trial ResultsFrom two trials as in Figures7 and 8, different hidden message data (public key and ciphertext) were obtained, even though the input data was the same.The different public key and ciphertext are caused by randomization of numbers generated by the On Time Password (OTP) function.For example, in the first trial, the OTP obtained was '5611'.The number '5611' Figure 8 below shows an example of a message hidden in an image.Figure 9 below shows an example of a message hidden in an image.

Figure 9
Figure 9 Example of a Hidden MessageThe next test was carried out with the same secret message input, namely "Army Polytechnic"

Figure 12
Figure 12 Comparison of the number of pixels (a) PVDMF (b) proposed method

Table 1 Symbol of Sengkalan Sentence Symbol List of Sengkalan Sentences
The number '5611' was changed to the phrase "sengkalan", which reads "Lek Maha Karengya Bajra".Meanwhile, in the second test, the OTP obtained was '6479'.From the OTP, the "sengkalan" sentence March 2024 https://doi.org/10.58291/ijec.v3i1.19452 obtained is "Guwa Kaswareng Marna Nem".Next, the sentence "sengkalan" was encoded using the LZW method.Where the results of the LZW encoding are used as the public key.