\newpage
\setstretch{2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Please enter the Chapter Title in the following in place of xxxxx. Use a label in place of yyyyy to be
%% referred later.
%% Please write the text in between the braces in place of AAAAA

\chapter{Methodology}
\label{yyyyy}
In this chapter, we have described the methodologies of our two proposed approaches. The first one is related to our new image steganography approach—ALIS (Attention-map and keyed LSB-based Image Steganography), and the second one is related to our new secret sharing approach (CBSS). In the following sections, we detail dataset acquisition and preprocessing, followed by attention map computation and prediction, and then secret image preparation, resizing, and the whitening process for ALIS. Then, we have also presented the embedding strategy along with optimization and the extraction process. On the other hand, for the CBSS approach, we firstly describe the secret share generation process from the secret key through the block masking technique, and then we describe the reconstruction process of the secret key again.

\section{ALIS (Attention-map and keyed LSB-based Image Steganography) }
\label{yyyyy}

We present ALIS as a unified keyed LSB (Least Significant Bit) based image steganography framework that uses attention maps. Figure~\ref{figure:proposed-approach} shows the architecture of adaptively embedding a grayscale secret image into a grayscale cover image while maintaining both visual quality and payload security. The framework leverages \textbf{attention maps}, derived either from a deep model (CNN or WGAN-GP) or fallback maps(traditional algorithm maps), to determine a per-pixel LSB depth allocation. This adaptive assignment increases embedding capacity in edge-rich areas, texture-rich areas, or both while minimizing distortion in smooth regions, effectively balancing imperceptibility and payload density. To ensure confidentiality and randomness in bit placement, the system derives cryptographic keys from a deterministic seed using \textbf{HMAC-SHA256}, and employs an \textbf{HMAC-DRBG-based keyed permutation} (a Fisher-Yates shuffle to pseudo-randomly reorder pixels of cover image indices for embedding~\cite{harba2018advanced,seno2019layer,hazra2015file}). This keyed permutation makes the spatial embedding pattern entirely dependent on secret keys and nonce values, significantly strengthening resistance against steganalysis. Before embedding, an optional secret image payload whitening step (via XOR secret image bits with a DRBG-generated keystream further obscures the statistical characteristics of the embedded bits~\cite{chavan2024cloud}.

\begin{figure}[H]
    \centering
    \includegraphics[height=.45\textheight]{Figs/Final_method.PNG}
    \caption{Architecture of ALIS (Embedding and Extraction)}
    \label{figure:proposed-approach}
\end{figure}

In the embedding process, the whitened secret image payload is embedded within the permuted cover image indices. At this stage, a robust encoded header is embedded before the payload. This header stores essential metadata, such as the nonce and message length, using a triply redundant bit-coding scheme with majority voting during decoding. Specifically, each bit is repeated three times, and the decoder outputs the value that appears in at least two positions, thereby correcting any single-bit error within each triplet. Majority voting is adopted because the header is critical for synchronization; this lightweight redundancy provides resilience against occasional bit flips caused by compression, noise, or resampling, without incurring the overhead of heavier error-correcting codes (ECCs), such as Hamming or Reed–Solomon codes, which introduce additional redundancy, complexity, and decoding latency.

In addition, a mini-attention map—a downsampled version of the original attention map—is embedded within the header. This enables the receiver to reconstruct approximate attention patterns and enhances robustness against the loss of auxiliary data. The header is used during both embedding and extraction to guide data placement toward visually complex regions of the image. To protect the system against attacks, the mini-attention map is heavily compressed and quantized so that it retains only coarse information about salient regions, without revealing precise embedding locations or exposing hidden data. A nonce (short for “number used once”) is a unique random value generated for each embedding session. Its primary purpose is to introduce unpredictability and prevent repeated patterns, thereby making it extremely difficult for attackers to reverse-engineer or predict the steganographic structure.

During the extraction process, candidate cover pixel indices are first identified. The header is then retrieved, the full attention map is reconstructed, and the embedded secret bits are extracted. Finally, the extracted bits are de-whitened and reshaped to recover the secret image. In this approach, two techniques are employed for embedding secret bits into cover pixels under the guidance of attention maps. The first technique is a fixed-threshold strategy, which discretizes the attention map into multiple importance tiers, each associated with a distinct embedding depth (e.g., 1–4 bits per pixel). Three thresholds, $T_1 < T_2 < T_3$, define four tiers ${\mathcal{T}_0, \mathcal{T}_1, \mathcal{T}_2, \mathcal{T}_3}$ that determine the number of bits embedded in each region.

The second technique optimizes these thresholds and the corresponding bit-depth configuration using a Genetic Algorithm (GA) to achieve an optimal trade-off between payload capacity (BPP) and image quality. The GA is integrated to optimize embedding parameters—specifically, the attention thresholds and bits-per-tier—for a desired balance between bits per pixel and image distortion. Each individual in the GA population represents a candidate solution consisting of three threshold values and four bit-depth assignments. Genetic operators, such as crossover and mutation, are applied to efficiently explore the search space. The GA configuration parameters (e.g., population size, number of generations, and mutation rate) can be adjusted according to computational constraints. The following subsections describe each stage of the framework in greater detail.

\subsection{Dataset Acquisition and Preprocessing}

The proposed framework is evaluated using two datasets: BOSSbase~\cite{wani2023deep} and USC-SIPI~\cite{al2025robust}. The BOSSbase dataset is widely used in steganography and steganalysis research and consists of 10,000 uncompressed grayscale images of size $512 \times 512$, captured using various digital cameras. This dataset provides diverse scene content, including smooth regions, rich textures, and strong edges, as well as variations in illumination and contrast, enabling realistic evaluation of both data-hiding and detection algorithms~\cite{sedighi2016}.The USC-SIPI image dataset is also a standard benchmark in image processing, compression, and steganography research. It contains both grayscale and color images, predominantly of size $256 \times 256$, categorized into miscellaneous images, textures, aerials, and sequences. The dataset includes well-known test images such as Lena and peppers~\cite{khandelwal2023reversible}.

In this work, both BOSSbase and USC-SIPI datasets are used to generate attention maps based on edge and texture features. The BOSSbase dataset, captured with different digital cameras, offers substantial variability in texture, noise, and illumination, which facilitates generalization across diverse visual patterns and supports accurate edge and texture extraction. Similarly, the USC-SIPI dataset includes both natural and synthetic scenes with clear geometric edges and varied texture structures, making it suitable for evaluating the sensitivity of the attention mechanism to fine structural variations.

Both edge-based and texture-based attention map generation require images with distinct variations in intensity and brightness, which are strongly present in both datasets. Moreover, using grayscale images simplifies structural pixel analysis by eliminating color interference, thereby improving the precision of the generated attention maps. If alternative datasets with different characteristics—such as color-dominated images, domain-specific content (e.g., facial or medical imagery), or limited texture diversity—were used, the behavior and performance of the attention maps would likely differ. In this study, the BOSSbase dataset is used as the source of cover images, while USC-SIPI images serve as secret images. Due to the limited dataset size, no separate validation set was employed. The model was trained exclusively on the training set, and all reported evaluation results are based on the test set.


\textcolor{blue}{We used 400 images from the mentioned datasets, divided into two disjoint subsets: a training set and a testing set. Specifically, 200 images were used for training, while the remaining 200 images were reserved exclusively for testing. The test images were not used during the training phase and were employed solely for performance evaluation to ensure an unbiased and fair assessment of the proposed method. For security evaluation, a paired dataset was constructed consisting of 200 cover images and their corresponding 200 stego images, forming one-to-one pairs. Prior to training, all image pairs were randomly shuffled using a fixed random seed (SEED = 2025) to ensure reproducibility. The dataset was then partitioned at the pair level into three disjoint subsets: 160 pairs for training, 20 pairs for validation, and 20 pairs for testing. Each subset contains matched cover and stego images stored in separate directories, and no image pair appears in more than one subset, thereby preventing data leakage. For each mini-batch, cover and stego samples were concatenated and labeled as class~0 (cover) and class~1 (stego), respectively. The validation set was used to monitor generalization performance during training, while all final performance metrics—including accuracy, ROC/AUC, and confusion matrices—were reported exclusively on the held-out test set.}

\subsection{Attention Map Computation and Prediction}

After obtaining the cover images from the BOSSbase dataset, the proposed framework proceeds to extract attention maps from these images. The framework supports two types of attention maps to guide the keyed adaptive per-pixel LSB embedding process: edge-based attention maps and texture-based attention maps. In this work, both types of attention maps are constructed independently and are used to guide the embedding and extraction processes. After computing the attention maps, the system is evaluated by comparing the attention values generated from traditional state-of-the-art edge- or texture-based detectors with those obtained using the proposed ALIS attention map generation method~\cite{niu2022image}.Specifically, ALIS produces the final attention map ($A$) by blending weighted contributions ($\alpha$ and $\beta$) of normalized edge or texture information with inverted distance map data. The distance map represents the distance of each pixel to the nearest reference region, such as an edge, texture pixel, or foreground pixel. The edge or texture maps ($E$ or $T$) and the distance map ($D$) are fused using a weighted combination as follows:
\begin{equation}
A = \alpha \cdot E + \beta \cdot \text{invD},
\label{eq:edge_fusion}
\end{equation}
or, equivalently, using the texture map:
\begin{equation}
A = \alpha \cdot T + \beta \cdot \text{invD},
\label{eq:texture_fusion}
\end{equation}
where $\alpha$ and $\beta$ control the relative contribution of local detail (edges or textures) and global smoothness (distance-based information), respectively.

The attention maps emphasize edge or texture regions more strongly when $\alpha$ is increased, resulting in a greater allocation of bits to highly edged or textured areas. This leads to higher embedding capacity and effective local concealment; however, excessive emphasis on edges may increase the risk of visible artifacts near sharp boundaries and slightly higher detectability. Conversely, decreasing $\alpha$ reduces the dominance of edges and textures, producing flatter attention maps and allocating fewer bits near strong edges, which improves visual smoothness at the cost of reduced payload capacity.

Increasing $\beta$ prioritizes distance information, emphasizing regions farther from strong edges or textures. This strategy distributes embedding across smoother neighborhoods, which generally improves imperceptibility and may reduce detectability, but can also lower payload capacity if textured regions are underutilized. In contrast, decreasing $\beta$ weakens distance regularization, causing the attention map to concentrate more strongly on edge or texture responses. While this can increase payload capacity, it may introduce edge-related noise if applied too aggressively.

Accordingly, higher embedding capacity can be achieved by increasing $\alpha$ and decreasing $\beta$, whereas improved visual quality and lower detectability are obtained by decreasing $\alpha$ and increasing $\beta$. Through experimental tuning, the embedding weights were set to $\alpha = 0.4$ for edge and texture regions and $\beta = 0.6$ for smooth regions. This configuration provides a balanced trade-off between embedding capacity and visual imperceptibility. Higher $\alpha$ values increase payload capacity but may introduce visible artifacts, while higher $\beta$ values preserve cleaner visual quality and lower detectability. The selected parameters were found to yield optimal performance in terms of both PSNR and SSIM.After computing the initial attention map dataset, two deep learning models—aConvolutional Neural Networks( CNN ) and a Wasserstein GAN with Gradient Penalty(WGAN-GP) are developed to predict attention maps for unseen test images, thereby improving the generalization capability of the proposed system. Attention map prediction aims to identify image regions with the highest perceptual or semantic importance.

The use of CNNs and WGAN-GP for attention map prediction is motivated by their complementary strengths in feature extraction and stable generative learning~\cite{kumar2023encoder,vineethaimage,malik2025hybrid,li2024gan}. CNNs are highly effective at capturing spatial and structural image features, enabling accurate identification of edges and texture regions. Consequently, they are well-suited for generating attention maps that highlight visually significant areas. In contrast, WGAN-GP improves generative stability and mitigates mode collapse—a common issue in traditional GANs in which the generator produces low-diversity outputs by covering only a limited subset of the true data distribution. By enforcing a soft 1-Lipschitz constraint through gradient penalty regularization, WGAN-GP ensures smoother optimization and more reliable convergence compared with conventional GANs~\cite{ren2024secure}. As a result, WGAN-GP produces smoother and more realistic attention maps by minimizing the Wasserstein distance between real and generated distributions, leading to improved visual consistency and convergence behavior.Details of the attention map computation and prediction process are provided in Chapter~4. After predicting the attention maps from the cover images, the next stage focuses on preparing the secret image for embedding.
 

\subsection{Secret Image Preparation with Resizing and Whitening}

At this stage, the total embedding capacity of a cover image is determined by summing the number of bits assigned to each pixel. The target number of embeddable bits depends on the cover image dimensions and the desired bits-per-pixel (BPP) value. Accordingly, the secret image is resized using bicubic interpolation to achieve the target byte count while preserving its original aspect ratio. The actual number of payload bits used for embedding is selected as the minimum between the target bit count and the available embedding capacity, thereby ensuring compliance with both capacity constraints and the specified BPP requirement.

After determining the available capacity, payload whitening is applied to the secret image bits. If a whitening key ($K_{\text{white}}$) is available, a keystream is generated using a deterministic random bit generator (DRBG) and XORed with the payload bits prior to embedding, providing an additional layer of confidentiality.

During the embedding process, the system shuffles the list of eligible cover pixel indices (per tier) to determine the embedding order. Specifically, cover pixels eligible for payload embedding are first grouped into \textit{tiers} based on an embedding-capacity score (e.g., attention or entropy). Within each tier, the pixel indices are \textbf{shuffled using a cryptographically seeded pseudo-random number generator (PRNG)} with seed $K_{\text{emb}}$. The resulting permutation \textbf{defines the exact write order} for that tier. At the receiver side, the same seed reproduces the identical permutation, ensuring \textbf{synchronized extraction without the need to store explicit embedding positions}. Consequently, each tier’s embedding sequence is both random and reproducible: randomness enhances security, while reproducibility guarantees accurate data recovery.

In this context, \textit{whitening} refers to a keyed bitwise obfuscation applied exclusively to the payload bits of the secret image, rather than to the cover or stego images themselves. Before embedding, the secret image is converted into a sequence of bytes and subsequently into a bitstream. This bitstream is XORed with a pseudo-random keystream generated deterministically by an HMAC-based deterministic random bit generator (HMAC-DRBG), which is seeded using the whitening key ($K_{\text{white}}$) and a per-message nonce. The resulting \textit{whitened bits}, which exhibit an approximately uniform statistical distribution, are then embedded into the least significant bits (LSBs) of the cover image according to the attention-guided bit allocation strategy and a keyed permutation defined by $K_{\text{emb}}$.

The actual write order is determined by a permutation generated from the secret embedding key $K_{\text{emb}}$ as shown in Figure~\ref{figure:proposed-approach2}. Specifically, $K_{\text{emb}}$ seeds a cryptographically secure PRNG that produces a reproducible shuffle of the eligible pixel (or coefficient) indices; using the same key at the decoder regenerates the permutation required for correct extraction. The embedding header, which contains the nonce and message length (each repeated three times for redundancy), is not whitened, ensuring that the receiver can reliably recover the nonce during the extraction phase. During extraction, the header is first read to obtain the nonce and the bit length of the hidden message. The embedded bits are then retrieved in the same keyed order and subsequently \textit{de-whitened} by XORing them with the identical keystream generated from the same $K_{\text{white}}$ and nonce. This process reconstructs the original secret bitstream and, consequently, the secret image. Whitening serves two primary purposes: it removes statistical patterns from the payload, thereby reducing detectability, and it protects the hidden content even if the embedding positions are discovered.



%\begin{figure}[H]
 %   \centering
  %  \includegraphics[height=.45\textheight]{Figs/Security Component.PNG}
 %   \caption{Stego Image (Header \& Body) Preparation from Cover and Secret Image }
  %  \label{figure:proposed-approach2}
%\end{figure}

\begin{figure}[H]
  \centering
  \includegraphics[
    width=1.0\textwidth,
    height=.6\textheight,
    keepaspectratio
  ]{Figs/Security_Draw.PNG}
  \caption{Stego Image (Header \& Body) Preparation from Cover and Secret Image}
  \label{figure:proposed-approach2}
\end{figure}



\subsection{Stego Image Header Preparation}

At this stage, and before embedding, we describe the process of generating the header that becomes part of the stego image and supports the embedding and extraction processes.The header contains essential metadata, including a nonce ($n_{\text{data}}$), the total message length (stored as a 32-bit little-endian integer), and a mini version of the attention map generated from the cover image. To enhance robustness, each header bit is repeated three times, and a simple \emph{majority voting} rule is applied during extraction; that is, for each triplet of bits, the value that appears at least twice is selected, thereby correcting any single-bit error. Collectively, the whitening process, redundant header encoding, and the embedded mini-attention map make ALIS secure and robust against noise, compression, and synchronization loss.

After the embedding process, the generated stego image contains a header with three main components (as illustrated in Figure~\ref{figure:proposed-approach2}):
\begin{itemize}
    \item \textbf{Mini attention map:} A compact, quantized, and downsampled version of the attention map stored in the header to safely guide the extraction process with minimal information leakage.
    \item \textbf{Nonce:} A random value generated once per session that introduces randomness and prevents pattern reuse or detection.
    \item \textbf{Message length:} The total number of bits in the secret message, enabling accurate extraction of the embedded data.
\end{itemize}

As described previously, the proposed steganographic system embeds three key elements within the header to ensure synchronization, robustness, and security: the mini attention map, the nonce, and the message length. The mini attention map is a downsampled and quantized representation of the full attention map originally derived from edge and texture information. It preserves only coarse spatial cues, providing general guidance for data extraction without revealing precise embedding locations. This allows the receiver to reconstruct an approximate attention map during extraction while maintaining resistance to reverse engineering.

The nonce (``number used once'') is a unique random value generated for each embedding session. It serves as a session-specific seed that controls keyed permutation of embedding positions and payload whitening. By preventing repeated embedding patterns, the nonce increases unpredictability and strengthens resistance to steganalysis and replay-based attacks. The message length represents the total number of bits in the hidden payload (i.e., the secret image). It is computed by converting the secret image into bytes and then into bits, with the exact count stored in the header. This ensures that the extraction process retrieves precisely the intended number of bits, avoiding truncation or overflow.

All three components—the mini attention map, nonce, and message length—are encoded in the header using triple-bit redundancy to improve robustness and error tolerance. During extraction, these values are decoded to reconstruct the mini attention map, recover the nonce, and determine the payload size, thereby enabling accurate and secure recovery of the hidden data while maintaining an effective balance among capacity, imperceptibility, and resistance to analysis.

In the proposed system, the header plays a critical role in synchronizing the embedding and extraction processes. First, the nonce acts as a session-specific random seed that drives pseudo-random operations, such as pixel permutation and payload whitening, ensuring that each stego image remains unique even when the same cover and secret images are reused. This property protects the system against pattern-based attacks and prevents identical embedding structures. Second, the message length specifies the exact number of bits in the hidden payload. This value is stored as a 4-byte integer in the header, enabling the decoder to extract the correct number of bits without truncation or overflow. Finally, the mini attention map is a compact and quantized approximation of the full-resolution attention map derived from the cover image. It is produced by downsampling and quantizing the original map into a smaller grid and embedding it within the header. During extraction, the mini attention map is decoded, dequantized, and upsampled to reconstruct an approximate attention distribution that guides extraction while preserving security by concealing exact embedding locations.All header components are triply replicated to provide robustness against bit errors. Together, they ensure that the extraction process can reproduce the correct pseudo-random order, read the appropriate amount of data, and utilize an accurate approximation of the attention map. This design achieves a reliable balance between security, capacity, and imperceptibility within the proposed steganographic framework.

In our implementation, the mini attention map is obtained by downsampling the full attention map (e.g., from a $256\times256$ cover image) to a compact grid (e.g., $16\times16$), followed by quantization to a small bit depth (e.g., 4 bits, mapping values in $[0,1]$ to integers in the range $0$--$15$). The \textbf{nonce} is a session-unique random value (e.g., 12 bytes, corresponding to 96 bits) and is subsequently used to seed the keyed permutation and whitening processes, ensuring unpredictability and unlinkability across sessions. The \textbf{message length} is the exact bit count of the payload (e.g., a $64\times64$ grayscale secret image contains $64\times64\times8 = 32{,}768$ bits) and is stored as a 4-byte little-endian integer. These components—nonce (12~B), message length (4~B), and the mini attention map (e.g., $16\times16\times4$ bits $= 128$~B)—are concatenated to form the header, and each bit is triplicated for error robustness, resulting in an overhead of approximately $(12 + 4 + 128) \times 3$ bytes in this example. After constructing the header, the embedding process is performed.


\subsection{High-Level Embedding Implementation} 

In the proposed framework, the cover image is first permuted using the embedding key. Subsequently, the embedding process is applied to the permuted (i.e., position-shuffled) cover image. Two independent permutations of cover pixel indices are generated:  
(1) a \emph{header permutation}, which uses a fixed nonce so that the header layout remains reproducible, and  
(2) a \emph{payload permutation}, which uses a fresh random nonce stored in the header to ensure that different embedding sessions are unlinkable.  
These permutations act as logical plans that determine the exact locations in the cover image where header and payload bits are written.

At this stage, an embedding key ($K_{\text{emb}}$) is derived from a root seed using HMAC–SHA256. A keyed pseudo-random number generator (HMAC–DRBG) then produces reproducible random values that drive all \textbf{shuffling of cover-pixel indices} used during embedding. The cover-image pixel indices are shuffled twice: once for the header and once for the payload. Both shuffles are generated by the same HMAC–DRBG but with different nonces. The header shuffle uses a fixed nonce ($n = 0$), ensuring a repeatable layout, whereas the payload shuffle uses a random nonce $n_{\text{data}}$ (stored in the header), which guarantees session unlinkability and semantic security.

The header is embedded first and physically written into the cover image, producing an intermediate stego image. During this step, the header bits are inserted into the LSBs of the pixels selected by the header permutation, using one bit per pixel to enhance robustness and honoring the per-pixel allocation constraints. Once this step is completed, the image contains the hidden header information and thus becomes the stego image. The presence of the header enables synchronization and parameter recovery during the extraction process.

ALIS employs a deterministic, \emph{keyed} pipeline to ensure that embedding is both secure and reproducible. After constructing the compact \textbf{header} that becomes part of the stego image, the attention map derived from the cover image is used to guide the embedding of the secret image and to form the payload region of the stego image. The payload is prepared by converting the secret image into a bitstream, which represents the content to be hidden.

Using predefined thresholds and a bit-allocation vector, the attention map is transformed into a per-pixel bit-allocation map. This step operates solely on the cover image and determines both the embedding capacity and the spatial embedding pattern. The secret payload is then physically written into the stego image following this cover-derived plan. Using the payload permutation of pixel indices and the per-pixel bit allocation $k_{ij}$ computed from the attention map, chunks of the whitened payload bits are sequentially embedded into the LSBs of the corresponding pixels. If a pixel allows $k_{ij}$ bits, its $k_{ij}$ least significant bits are replaced with the corresponding payload bits. If the requested payload exceeds the total embedding capacity $\sum k_{ij}$, the payload bitstream is truncated to match the available capacity.
{\color{blue}
When the embedding capacity of the cover image exceeds the size of the secret image, the proposed method does not force full utilization of the available capacity. Instead, a target payload size is determined based on a predefined embedding rate (BPP), and the actual number of embedded bits is limited to
\[
\min(\text{target\_bits}, \text{capacity\_bits}).
\]
A compact header is embedded at the beginning of the stego image, containing a nonce and the exact message bit length (\texttt{msg\_bitlen}). During embedding, the algorithm inserts payload bits until the end of the secret bitstream is reached and then stops, leaving any remaining candidate pixels unchanged. During extraction, the decoder first reads the header to obtain \texttt{msg\_bitlen} and then extracts exactly that number of bits, ensuring correct reconstruction even when unused embedding capacity remains.
}

\subsection{High-Level Extraction Implementation}

The extraction process begins with the stego image, which is visually indistinguishable from the original cover image but internally contains both the embedded header and payload data within its least significant bits (LSBs). The objective is to recover the original secret image by first extracting the synchronization information (i.e., the header) and then decoding the payload bitstream according to the same keyed and attention-guided rules used during embedding.The first step is to reconstruct the header embedded at the beginning of the embedding process. Using the same keyed permutation generated from the embedding key ($K_{\text{emb}}$) with a fixed nonce ($n = 0$), the extractor identifies the exact pixel positions reserved for header storage. The LSBs of these pixels are then read sequentially to recover the header bits. Since each header bit was triplicated for redundancy, a majority-voting decoding scheme is applied to each group of three bits to correct potential noise-induced or processing-related bit errors. Once the header bitstream is reconstructed, it is parsed to retrieve the payload nonce, the message length (i.e., the total number of embedded bits), and the mini attention map (quantized sketch), if it was stored. This step completes the extraction of the control data directly from the stego image.

Next, the attention map is reconstructed. If a mini attention map is present in the header, it is dequantized and upsampled to the original image resolution to reconstruct an approximate full attention map. This reconstructed attention map is then used to derive the per-pixel bit-allocation matrix $k_{ij}$, which specifies the number of bits embedded in each pixel. If no mini attention map is available, a fallback attention estimate (e.g., an edge-based Sobel attention map) is computed directly from the stego image. This step provides the spatial embedding plan required to correctly decode the payload bits.

With the payload nonce obtained from the header and the embedding key ($K_{\text{emb}}$), the system reinitializes the HMAC--DRBG to reproduce the same deterministic pseudo-random sequence that defined the payload permutation during embedding. This guarantees perfect synchronization between the embedding and extraction processes, as the same permutation of pixel indices is regenerated. If a whitening key ($K_{\text{white}}$) was used during embedding, the same HMAC--DRBG configuration is subsequently employed to regenerate the whitening keystream.

Using the regenerated payload permutation and the reconstructed bit-allocation matrix $k_{ij}$, the extractor reads the LSBs of the pixels assigned to carry payload data. For each pixel, the $k_{ij}$ least significant bits are extracted and appended sequentially to form a continuous payload bitstream. This process continues until the number of extracted bits matches the message length obtained from the header. At this stage, the completely whitened payload bitstream has been recovered from the stego image.

If whitening was applied during embedding, the whitening process is then reversed. The same whitening keystream is regenerated using $K_{\text{white}}$ and the recovered nonce, and the extracted bitstream is XORed with this keystream to obtain the original message bits. These bits are subsequently grouped into bytes, converted back into intensity values, and reshaped to match the original dimensions of the secret image. This process yields the final recovered secret image.


\begin{figure}[htbp]
  \centering
  % اضبط القيمتين كما تشاء (مثال بنسبة من الصفحة)
  \includegraphics[width=1.0\textwidth,height=0.90\textheight,keepaspectratio]{Figs/Embedding_Extraction.PNG}
  \caption{Embedding and Extraction Processes.}
  \label{fig:Embedding and Extraction Processes.}
\end{figure}
Figure~\ref{fig:Embedding and Extraction Processes.} presents an example of the embedding and extraction workflow implemented in the ALIS framework. The upper part of the diagram illustrates the embedding process, in which the cover image is used to conceal the secret image. Before embedding, the secret image undergoes two preprocessing steps—resizing and encryption—to protect its content and produce an unidentifiable encrypted payload. The resulting stego image preserves the visual appearance of the original cover image and exhibits no perceptible evidence of data insertion. The lower part of the diagram illustrates the extraction process, demonstrating how the hidden data are recovered from the stego image. The extracted encrypted payload is subsequently decrypted to achieve an accurate reconstruction of the original secret image. Overall, the diagram highlights how the proposed embedding technique maintains high cover image quality while enabling secure and reliable recovery of hidden data during extraction.It also shows sample visual results of the proposed embedding approach. 

\subsection{Genetic Algorithm for Threshold and Bits Optimization}

In the ALIS framework, two different approaches are implemented to control the embedding strength and adaptivity of the bit-allocation process: a fixed-threshold strategy and an optimized configuration based on a Genetic Algorithm (GA). Both approaches rely on the attention map generated from the cover image, which highlights regions with strong edges or textures that are suitable for high-capacity embedding, as well as smooth regions where only a limited number of bits can be embedded without introducing visible distortion. However, the two approaches differ fundamentally in how the attention thresholds and bit-allocation levels are determined.In the fixed-threshold approach, predefined static values are used for both the attention thresholds and the number of bits embedded per pixel. Specifically, three threshold values $[0.3,\,0.6,\,0.8]$ divide the attention map into four embedding levels corresponding to the bit vector $[1,\,2,\,3,\,4]$. Pixels with attention values below $0.3$ are assigned one hidden bit, while pixels with attention values above $0.8$ may carry up to four bits. This rule-based mapping is applied uniformly across all images using the function \texttt{decode\_allocation()}, which converts the continuous attention map into a discrete bit-allocation matrix $k_{ij}$. The payload bits are then embedded into the least significant bits (LSBs) of the cover pixels according to $k_{ij}$, guided by the keyed permutation generated using HMAC-DRBG. Although this approach is simple and computationally efficient, it lacks adaptivity. It does not account for variations in image content or attention distributions, which may lead to suboptimal performance. Static thresholds may allocate too many bits to visually sensitive regions in some images or too few bits to highly textured regions in others. Consequently, this approach often yields moderate embedding quality, typically resulting in lower PSNR and SSIM values compared to optimized methods.

To address the limitations of fixed thresholding, the system integrates a GA to automatically search for an optimal set of thresholds and bit-allocation values that maximize image quality and embedding efficiency. In this optimization process, each individual in the GA population represents a candidate solution defined by a pair $(\mathbf{t}, \mathbf{b})$, where $\mathbf{t}$ is a vector of threshold values and $\mathbf{b}$ is a vector of corresponding bit-allocation levels. The algorithm begins by generating an initial population of random individuals, with threshold values sampled from the range $[0.2,\,0.95]$ and bit levels selected from $\{1,2,3,4\}$. Each candidate configuration is evaluated through an actual embedding operation. The resulting stego image is compared with the original cover image using Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity Index Measure (SSIM) as fitness criteria, where higher PSNR and SSIM values indicate better visual quality and lower distortion. The best-performing individuals are selected for reproduction through crossover operations, which combine partial threshold and bit sequences, and mutation operations, which introduce small random variations to maintain diversity. This evolutionary process is repeated for multiple generations, progressively refining the parameter set toward optimal values. The final output of the GA is the configuration of thresholds and bit levels that achieves the highest PSNR and SSIM for the given image and attention map.

In the proposed GA implementation, the objective is to identify the optimal combination of attention thresholds and per-tier bit distributions for adaptive keyed LSB image steganography. Each population member consists of two components: a three-element threshold vector sorted in ascending order and a four-element bit-allocation vector. The algorithm starts by generating a random initial population. The fitness evaluation of each individual is performed in two stages: first, resizing the secret image to match the target BPP, and second, performing embedding using the mini-attention mode with a $16 \times 16$ attention map. The GA seeks to maximize PSNR while minimizing $1 - \text{SSIM}$ when evaluating stego image quality. During reproduction, top-performing individuals are selected to generate offspring through crossover operations that combine threshold and bit-allocation vectors, as well as mutation operations that introduce random changes to preserve population diversity. The algorithm runs for a predefined number of generations and terminates when the individual with the highest PSNR fitness value is identified, yielding an optimal set of embedding parameters that achieves high payload capacity with minimal visual degradation.


\begin{table}[ht]
\centering
\small
% تقليل الحشو داخل الخلايا لتقليل العرض الكلي
\setlength{\tabcolsep}{6pt}       % حشو أفقي داخل الخلايا (افترِض 6pt أو 4pt)
\renewcommand{\arraystretch}{1.15} % حشو عمودي داخل الخلايا
\setlength{\arrayrulewidth}{0.6pt} % سمك خطوط الجدول (جرب 0.4pt أو 0.8pt)

% استخدم أعمدة p مع خطوط عمودية حول كل عمود: |p{..}|p{..}|
% اجعل مجموع نسب العرض أقل من 1.0 لتجنب تجاوز \linewidth.
\begin{tabular}{|p{0.36\linewidth}|p{0.58\linewidth}|}
\hline
\textbf{Parameter} & \textbf{Value} \\ \hline
Population size & 12 \\ \hline
Number of generations & 20 \\ \hline
Thresholds range & [0.2, 0.95] \\ \hline
Bits per tier & 1 -- 4 \\ \hline
Crossover type & One-point for thresholds, splice for bits \\ \hline
Mutation probability & 0.3 (applied during GA loop) \\ \hline
Mini-map size (embedding) & 16 $\times$ 16  \\ \hline
Bits per mini value & 4 (default) \\ \hline
Nonce size & 12 bytes \\ \hline
Key derivation & HMAC-SHA256 from seed \\ \hline
Fitness metrics & Maximize PSNR, minimize $1-\mathrm{SSIM}$ \\ \hline
\end{tabular}
\caption{Genetic algorithm and embedding parameters used in the framework.}
\label{tab:ga_params}
\end{table}

The proposed keyed LSB steganography framework employs the parameters listed in Table~\ref{tab:ga_params} to control the genetic algorithm (GA), mini-attention embedding, and cryptographic operations. The GA operates with a population size of 12 individuals and runs for 6 generations, achieving effective optimization while maintaining computational efficiency. Each individual encodes three attention threshold values within the range $[0.2,,0.95]$ and four bits-per-tier values within the range $[1,,4]$. The GA applies one-point crossover for threshold values and splice crossover for bit-allocation vectors, with a mutation probability of 0.3.

The framework supports mini-attention map processing at multiple scales through the use of a $16 \times 16$ mini-attention map for embedding operations. The default quantization scheme for each mini-map cell uses 4 bits per cell. For keyed operations, a nonce size of 12 bytes is employed, and all cryptographic keys are derived from the provided seed using HMAC-SHA256. During GA evaluation, the fitness function is designed to maximize PSNR while minimizing structural dissimilarity, expressed as $(1 - \mathrm{SSIM})$, thereby ensuring both high visual quality and preservation of the cover image structure. Overall, the selected parameter configuration achieves a balanced trade-off among embedding capacity, visual quality, and computational efficiency.

{\color{blue}
GA was selected because the optimization problem is hybrid (continuous thresholds and discrete bit allocations) and non-differentiable due to thresholding and bit-level embedding operations. Additionally, the objective involves balancing imperceptibility and payload constraints, which forms a discontinuous search landscape where gradient-based methods are not applicable. Thus, GA provides a robust derivative-free optimization mechanism for exploring this space and improving the embedding configuration.
}


\section{ CBSS (Counting Based Secret Sharing)}
After developing the adaptive image steganography framework -ALIS, which securely embeds secret information within a cover image using attention-guided and key-driven embedding strategies, the next stage extends this work toward a higher level of information security and reliability through a Counting-Based Secret Sharing (CBSS) mechanism. In this integrated design, the stego image produced by the steganographic system is not merely treated as a container for hidden data but also serves as a generator of multiple cryptographic keys. Specifically, every 64-bit segment extracted from the stego image is interpreted as an individual secret key, which is then divided into multiple shares according to the CBSS scheme. This process enables secure distribution and redundancy of the hidden information—ensuring that only authorized participants possessing a sufficient number of valid shares can reconstruct the original secret keys. The combination of the adaptive image steganography model with CBSS thus creates a multi-layered security framework that simultaneously guarantees data confidentiality, robustness, and recoverability, reinforcing the system’s applicability in secure multimedia communication and distributed cryptographic storage. 

\begin{figure}[h]
    \includegraphics[width=1.0\linewidth]{Figs/New_CBSS.PNG}
    \caption{Counting based secret sharing Scenario}
    \label{figure:Counting based secret sharing Scenario}
\end{figure}


The secret sharing scheme distributes the secret key among multiple participants to ensure the reliability of the key. A new version of secret sharing called counting-based secret sharing (CBSS) has been emerged to divide the secret key into multiple shares (copies of the secret key with some modifications) and distribute these key shares among several individuals in such a way that only the authorized subset of participants needs to agree together to reconstruct the original secret key as shown in Figure~\ref{figure:Counting based secret sharing Scenario}. Existing CBSS schemes suffer from heavy computational and storage requirements for generating the key shares and reconstructing the secret key and also are vulnerable to share leakage.  This research overcomes the challenges that appear in the existing CBSS methods by dividing the secret key into adjacent blocks and by generating ambiguous secret shares based on block-based masking. In this approach, the secret shares are generated by XOR-ing each separate block of the  secret key with a specific sequence of 1s, where the total number of 1s is determined based on the block size. Our proposed approach can also reconstruct the secret key efficiently by assembling a subset of shares following a threshold (minimum number of secret shares that are able to reconstruct the secret key). 

%Through experimentation, we found that our proposed CBSS strategy offers a remarkable secure contribution in making a trade-off between security and cost of computation. Our experiment results also suggest that the average similarity between the secret key and secret shares decreases and the security level increases when the block size of the secret key in our proposed system.

% \subsection{Proposed Methedology}
%\label{Ch4: Overview}
This research attempts to enhance the key share generation and reconstruction techniques of the original CBSS method proposed in~\cite{gutub2019counting}. The illustrated Figure~\ref{figure:Counting based secret sharing Scenario} starts with a cryptographic random-number generator (RNG) that generates a 64-bit secret key. The key gets divided into M blocks which get transformed into share sets \(\{\mathrm{Sh}_1,\dots,\mathrm{Sh}_n\}\) for distribution. Each block receives a fixed sequence of ones gets XORed before share generation and any K-size subset can restore the original secret key. The RNG appears in the flowchart during reconstruction to indicate that randomness serves multiple purposes throughout the scheme's operational cycle. The design uses simple XOR operations and basic share combination which results in minimal computational overhead and straightforward implementation on limited resource systems. The threshold property (\(K\)-out-of-\(n\)) protects against data loss while limiting disclosure to adversaries who possess at least \(K\) shares. The scheme depends solely on RNG unpredictability and additional share generation randomness for confidentiality because XOR operations with constant sequences (all ones) produce deterministic and invertible results that add no entropy. The system needs stronger security through the implementation of randomized per-block masks or secure pseudorandom generator-derived linear combinations for XOR operations and must include integrity/authentication mechanisms such as MACs or digital signatures to detect share tampering. The security level and storage requirements and communication expenses of the system depend on the secret length (64 bits) and the number of blocks (M) and shares (n) and threshold (K) which need to be determined based on the target adversary model and application requirements.



We provided a new strategy using block segmentation to generate the secret shares, Sh$_x$ from the secret key, S$_K$. This scheme can be explained in two steps, the first step is to generate key Sh$_x$ from the  S$_K$ and the second step is to reconstruct the  S$_K$ from a subset of Sh$_x$. The general approach of our work start with generating the S$_K$  randomly, then generating the shares Sh$_x$, after that the  S$_K$ is reconstructed again.
In the following sections, we will explain in detail the main steps that we apply in our counting-based secret sharing models --- (1) Secret key generation, (2) Secret shares generation ``Block Masking Approach", (3) Secret key reconstruction ``Block unmasking approach". 


\subsection{Secret Key Generation }
Before initiating the Counting-Based Secret Sharing (CBSS) process, it is essential to ensure the generation of secure and truly random secret keys that will serve as the foundation of the sharing scheme. In the proposed framework, the secret keys are derived from the stego image produced by the preceding image steganography stage, where each 64-bit segment of the stego data is treated as an independent key candidate. Since the security and unpredictability of these keys directly determine the robustness of the entire CBSS mechanism, a reliable key generation and validation phase must precede the sharing process. A random 64-bit secret key (S$_K$) is generated, evaluated for randomness, and validated using standard statistical tests to ensure its suitability for secure secret sharing.
As the secret key, S$_K$ should not be known to any participant, so S$_K$ sequence has to be random, and the involved parties or the intruder fails to guess the sequence of S$_K$. 
%The Algorithm 1 produces S$_K$ as a trusted S$_K$ of 64 bits in binary format using a Random Number Generator (RNG). 
To obtain an appropriate random  S$_K$ for CBSS, we performed  the frequency (Monobit) test, which is the standard experiment of NIST 800-22 suites, to check the randomness of a number ~\cite{beimel2005characterizing,morillo1999weighted,alkhodaidi2022scalable}. In our work, after performing the frequency test, we have assumed that if the P-value is greater than or equal to 0.8, then the random secret key is said to be highly reliable to be used. Likewise, if the P-value is less than  0.2, then the secret keys are supposed to be of low reliability and should not be used. As for the remaining secret keys in which P-values are between 0.2 and 0.8, they have a medium level of reliability and can also be used (if needed).


\subsection{Secret Shares Generation - Block Masking Approach}
After generating and validating the random 64-bit secret key S$_K$, the next step is to securely divide and distribute these keys among multiple participants through a secret sharing mechanism. Since the confidentiality of the CBSS framework depends not only on the randomness of the secret key but also on the way it is fragmented and masked, an effective share generation strategy is required to prevent unauthorized reconstruction of S$_K$. To achieve this, the Block Masking Approach is adopted, in which each validated secret key is partitioned into equal-sized blocks before generating its corresponding shares. This approach enhances key protection by ensuring that no single share or subset of bits reveals meaningful information about the original secret key. %The following subsection explains in detail how the block masking mechanism is applied to produce consistent and secure secret shares (Sh$_x$)from the generated keys, thereby reinforcing the resilience and scalability of the proposed Counting-Based Secret Sharing scheme.

In our work, we do not depend on a specific type of the S$_K$  bits rather, we generate the  S$_K$ randomly, and then we divide it into adjacent blocks. We then take each separate block and XOR it with a specific sequence of 1 (where the total number of 1's is related to the block size). These secret shares  Sh$_x$ are generated from S$_K$ in a manner that the size of each block is kept the same. To maintain a consistent block size, the required padding is performed, when needed. The aim of partitioning the  S$_K$ into blocks is to enhance security and to make it harder for an eavesdropper to guess S$_K$ from the Sh$_x$ \cite{gutub2019counting}. In our study, we used the 2-bits block model, 4-bits block model, and 8-bits block model for secret share generation. These models afford different levels of security and provide different numbers of secret Sh$_x$ that may be useful in the applications of CBSS.

\subsection{Secret Key Reconstruction - Block Unmasking Approach}

Following the generation of the secret shares using the block masking approach, the next essential phase in the Counting-Based Secret Sharing (CBSS) process is the reconstruction of the original secret key (S$_K$) from the distributed shares. While the masking stage ensures that each share individually reveals no useful information about the original key, the reconstruction stage restores (S$_K$) only when a sufficient number of legitimate shares are combined. This ensures both confidentiality and recoverability—two fundamental properties of any secure sharing scheme. Accordingly, the Block Unmasking Approach is employed to reverse the masking process and recover the correct secret key once the required threshold of shares is available. 
%The following subsection explains how  The CBSS mechanism identifies the threshold value \texttt{k} out of M total shares and utilizes the counting-based logic to accurately rebuild (S$_K$), verifying its authenticity against the originally generated key. 
To reconstruct the initial S$_K$, the CBSS method identifies a threshold value of \texttt{k} out of \texttt{M} shares, where \texttt{M} is the total number of valid secret shares Sh$_x$ and \texttt{k} is the threshold representing the minimum of shares required to reconstruct S$_K$ from Sh$_x$. The \texttt{k} shares are fed into our CBSS system and all the Sh$_x$ are processed to meet the criteria for counting bits.  If the counting result of the corresponding bits' grouping for one column is equal to or greater than \texttt{k}, then the output location related to this bit is given a bit one; otherwise, the bit is set to zero, and so on. These reconstructed outcome bits are compared with the initial correct S$_K$ to verify whether it is authentic or not.
%\end{document}

\subsection{CBSS Algorithms}
We also described the step-by-step process of secret share generation in Algorithm 1 and secret key reconstruction using our proposed approach in Algorithm 2. Our CBSS algorithm takes a random  S$_K$, number of shares M, and a threshold value k as inputs and produces M secret shares [Algorithm1, lines 1-2]. First of all, it calculates the number of bits (N) in the S$_K$  and determines the block size (Bn = N/M) [Algorithm1, lines 4-5]. Then, an empty array is considered to store the generated  shares (Sh$_k$[M] = []). Again, the algorithm generates a new number, X as a sequence of binary ones that we gets bit-wise XOR-ed with each of the blocks to generate shares [Algorithm1, lines 6-7]. The value of X depends on the block size, and for each block the value of Y gets calculated after the XOR operation [Algorithm1, line 10]. 
The shares are generated sequentially and placed in the Sh$_k$ array as Sh$_k$ = Y [Algorithm1, lines 11]. To reconstruct the S$_K$, Algorithm 2 forms a matrix S  with m rows (the  number of shares) and n columns (the length of each share) from the generated shares, and it also considers the reconstructed threshold $k$ as input [Algorithm2, lines 1-4]. Then, the secret key, S$_K$ key of length n is reconstructed. For this, the count of ones in each column of S is made, and the algorithm applies threshold k to determine each bit of the reconstructed key (S$_K^j$). If the count (in j-th column) is greater than or equal to the threshold k, then the algorithm sets the j-th bit (S$_K^j$) as 1 else set it as 0 [Algorithm2, lines 5-10].

%\begin{algorithm}
% \caption{Proposed Secret Share Generation Algorithm}
%\textbf{Algorithm 1: Proposed Secret Share Generation }\\
 % \scriptsize
%\begin{algorithmic}[1]
%\State \textbf{Input:} Random Secret Key $S_k$, Number of Shares $M$, Reconstruction Threshold $k$
%\State \textbf{Output:} SECRET SHARED KEYS $Sh_k[M]$
%\Procedure{Share Generation}{}
 %   \State $N = \text{Size}(S_k);$ \Comment{Number of digits in the binary $S_k$}
 %   \State $Blocksize, B_n = N/M;$ \Comment{Padding considered (if required)}
 %   \State $Sh_k[M] = [  ];$ \Comment{Initialize an empty array to store the generated shares}
%    \State $X = 2^{(B_n-1)} + 2^{(B_n-2)} + 2^{(B_n-3)} + \dots + 1;$ \Comment{Determined based on the block size}
 %   \State $i = 1;$ $j = B_n;$ \Comment{$i$, $j$ are the indices of the bits in $S_k$}
%    \For{each block $B_m$ in $S_k$}
%        \State $Y = (S_k[i,j] \oplus X) || (S_k)$ for all bits indexed as $b$, except $i \leq b \leq j;$
%        \State $Sh_k[m] = Y;$ \Comment{Add the generated share to the shares array}
%        \State $i = j + 1;$ $j = j + B_n;$ $m++$;
%    \EndFor
%\EndProcedure
%\end{algorithmic}
%\end{algorithm}

% ========== إعدادات خفيفة (بدون حزم) ==========
\newlength{\algindent}\setlength{\algindent}{1.5em}
\newcommand{\I}{\hspace*{\algindent}}
\newcommand{\II}{\hspace*{2\algindent}}
\newcommand{\cmt}[1]{\(\triangleright\)\,\textit{#1}}

% تقليل المسافات داخل الجدول وبين الصفوف
\setlength{\tabcolsep}{2pt}
\renewcommand{\arraystretch}{0.82}

% سطر (رقم | متن بعرض ثابت | تعليق بعرض ثابت) — يبقى في سطر واحد
\newcommand{\AlgRow}[3]{%
  #1:\! &
  \makebox[0.60\linewidth][l]{#2} &
  \makebox[0.33\linewidth][l]{#3}\\[-0.45ex]}

\vspace{0.1em}
% ===== صندوق الخوارزمية =====
\noindent\fbox{%
  \begin{minipage}{\linewidth}
  \textbf{Algorithm 1: Proposed Secret Share Generation}\par
  \vspace{0.1em}\hrule\vspace{0.1em}

  % ثلاثة أعمدة: رقم | متن (0.60) | تعليق (0.33)
  \begin{tabular}{@{}r l l@{}}
  \AlgRow{1}{\textbf{Input:} Random Secret Key $S_k$, Number of Shares $M$, Reconstruction Threshold $k$}{}
  \AlgRow{2}{\textbf{Output:} SECRET SHARED KEYS $Sh_k[\,M\,]$}{}
  \AlgRow{3}{\textbf{procedure} \textsc{ShareGeneration}}{}
  \AlgRow{4}{\I $N \leftarrow \mathrm{Size}(S_k)$}{\cmt{Number of bits in $S_k$}}
  \AlgRow{5}{\I $B_n \leftarrow N/M$}{\cmt{Block size}}
  \AlgRow{6}{\I $Sh_k \leftarrow [\,]$}{\cmt{Array to store generated $Sh_k$}}
  \AlgRow{7}{\I $X \leftarrow 2^{B_n-1}+2^{B_n-2}+2^{B_n-3}+\cdots+1$}{\cmt{Depends on block size}}
  \AlgRow{8}{\I $i \leftarrow 1$;\; $j \leftarrow B_n$}{\cmt{$i,j$ are indices in $S_k$}}
  \AlgRow{9}{\I \textbf{for} $m \leftarrow 1$ \textbf{to} $M$ \textbf{do}}{}
  \AlgRow{10}{\II $Y \leftarrow (S_k[i{:}j]\oplus X)\ \Vert\ S_k[1{:}i{-}1]\ \Vert\ S_k[j{+}1{:}N]$}{}
  \AlgRow{11}{\II $Sh_k[m] \leftarrow Y$}{\cmt{Add generated share to array}}
  \AlgRow{12}{\II $i \leftarrow j+1$;\; $j \leftarrow j+B_n$;\; $m \leftarrow m+1$}{}
  % احذفي السطرين التاليين إذا لا تريدين ظهور end
  \AlgRow{13}{\I \textbf{end}}{}
  \AlgRow{14}{\textbf{end procedure}}{}
  \end{tabular}

  \vspace{0.1em}\hrule
  \end{minipage}
}



%\documentclass[11pt]{article}

% ===== لا حزم إضافية =====
\setlength{\parindent}{0pt}
\newlength{\algindent}\setlength{\algindent}{1.5em}
\newcommand{\I}{\hspace*{\algindent}}
\newcommand{\II}{\hspace*{2\algindent}}
\newcommand{\III}{\hspace*{3\algindent}}
\newcommand{\cmt}[1]{\(\triangleright\)\,\textit{#1}}

% تقليل الهوامش داخل الجدول وبين الصفوف
\setlength{\tabcolsep}{2pt}
\renewcommand{\arraystretch}{0.82}

% صف خوارزمية: رقم | متن (ثابت العرض) | تعليق (ثابت العرض) — كله في سطر واحد
\newcommand{\AlgRow}[3]{%
  #1:\! &
  \makebox[0.60\linewidth][l]{#2} &
  \makebox[0.33\linewidth][l]{#3}\\[-0.45ex]
}

%\begin{document}

% ====== Algorithm 2: Proposed Secret Key Reconstruction ======
\noindent\fbox{%
  \begin{minipage}{\linewidth}
  \textbf{Algorithm 2: Proposed Secret Key Reconstruction}\par
  \vspace{0.1em}\hrule\vspace{0.1em}

  % ثلاثة أعمدة: رقم | متن | تعليق (كلاهما لا يلتف)
  \begin{tabular}{@{}r l l@{}}
  \AlgRow{1}{\textbf{Input:} SHARED KEYS $Sh_k[\,M\,]$, Total Shares $M$, Reconstruction Threshold $k$}{}
  \AlgRow{2}{\textbf{Output:} Secret Key $S_k$}{}
  \AlgRow{3}{\textbf{procedure} \textsc{KeyReconstruction}}{}
  \AlgRow{4}{\I $S \leftarrow \mathrm{matrix}(Sh_k)$}{\cmt{Matrix of shares $m\times n$}}
  \AlgRow{5}{\I \textbf{for} $j \leftarrow 1$ \textbf{to} $n$ \textbf{do}}{\cmt{$n$ = length of each share}}
  \AlgRow{6}{\II $Count_j \leftarrow \sum_{i=1}^{m} S_{i,j}$}{\cmt{# of ones in column $j$}}
  \AlgRow{7}{\II \textbf{if} $Count_j > k$ \textbf{then}}{}
  \AlgRow{8}{\III $S_k[j] \leftarrow 1$}{\cmt{Set bit $j$ of $S_k$ to 1}}
  \AlgRow{9}{\II \textbf{else}}{}
  \AlgRow{10}{\III $S_k[j] \leftarrow 0$}{}
  \AlgRow{11}{\II \textbf{end if}}{}
  \AlgRow{12}{\I \textbf{end for}}{}
  \AlgRow{13}{\textbf{end procedure}}{}
  \end{tabular}

  \vspace{0.1em}\hrule
  \end{minipage}
}
\subsubsection{CBSS Proof and Security Analysis and Limitations of the CBSS Scheme}

{\color{blue}
The proposed Counting-Based Secret Sharing (CBSS) scheme is designed to provide threshold-based confidentiality, redundancy, and loss resilience rather than standalone cryptographic encryption. Its primary objective is to ensure that the original secret key (S$_K$) can be reconstructed only when at least a predefined number of valid shares ($k$ out of $n$) are available, while preventing recovery from any smaller subset. From an information-theoretic perspective, the secrecy of the secret key under partial disclosure can be expressed using conditional entropy. Let ${Sh_1, Sh_2, \ldots, Sh_{k-1}}$ denote any subset of fewer than $k$ secret shares. The uncertainty of the secret key given these shares can be approximated as:
\begin{equation}
H(S_K \mid Sh_1, Sh_2, \ldots, Sh_{k-1}) \approx H(S_K)
\end{equation}

This relation indicates that, as long as the reconstruction threshold is not met, the amount of information revealed about the secret key remains insufficient for deterministic recovery. Although CBSS employs deterministic XOR-based block masking, the threshold reconstruction mechanism ensures that incomplete share sets preserve a high level of ambiguity regarding the original key.

Experimental observations further support this analysis. Increasing the block size during share generation significantly reduces similarity among the generated shares and between individual shares and the secret key. This reduction in similarity increases uncertainty and limits the feasibility of inferring the original secret from fewer than $k$ shares, even when the masking strategy is known.

Despite these properties, it is important to clearly define the security boundaries of the CBSS scheme. The deterministic XOR-based masking used in block-wise share generation does not introduce additional entropy and is inherently reversible. Consequently, CBSS does not claim semantic security, computational indistinguishability, or resistance to cryptanalytic attacks such as known-share or chosen-share attacks. If an adversary obtains $k$ or more valid shares, reconstruction of the secret key becomes possible by design, consistent with the principles of threshold secret sharing.

Under the assumed threat model, adversaries are limited to obtaining fewer than $k$ shares and do not control the share distribution process. Within this model, CBSS effectively prevents unauthorized reconstruction while enabling controlled group access and robustness against share loss. The scheme is therefore suitable for applications that require multi-party authorization and resilience rather than strong cryptographic secrecy.
}
In the proposed framework, CBSS is intentionally integrated with the ALIS steganographic system, cryptographically secure key generation, and keyed embedding operations. This layered design compensates for the deterministic nature of the masking operation by ensuring that secret shares are concealed within stego images and protected by cryptographic randomness at other system layers. As a result, the overall system achieves practical security through a defense-in-depth strategy.

Future work may further strengthen CBSS by replacing deterministic block masking with pseudo-random or polynomial-based masking strategies, such as Shamir-style secret sharing, while preserving the low computational complexity that makes CBSS suitable for resource-constrained environments.



%\end{document}
\



















%\begin{algorithm}
% \caption{Proposed Secret Key Reconstruction Algorithm}
%\textbf{Algorithm 2: Proposed Secret Key Reconstruction}\\
%  \scriptsize
%\begin{algorithmic}[1]
%\State \textbf{Input:} SHARED KEYS $Sh_k[M]$, Total Shares $M$, Reconstruction Threshold $k$
%\State \textbf{Output:} Secret Key $S_k$
%\Procedure{Key Reconstruction}{}
%    \State $S = \text{matrix}(S_k)$ \Comment{The matrix of generated shares with dimensions $m \times n$, where $m$ is the number of shares and $n$ is the length of each share;}
%    \For{$j = 1$ to $n$} \Comment{where $n$ is the length of each share}
%        \State Let $Count_j = \sum_{i=1}^{m} S_{ij}$ be the count of ones in column $j$;
%        \If{$Count_j > k$}
%            \State Set $S_{jk} = 1$ \Comment{the bit in the $j$-th position of $S_k$ is set to 1}
%        \Else
%            \State Set $S_{jk} = 0$
%        \EndIf
%    \EndFor
%\EndProcedure
%\end{algorithmic}
%\end{algorithm}


\subsection{Illustrative Examples}

In this section, we will discuss our secret key models based on 2-bits block (i.e. Example 1), 4-bits block (i.e. Example 2), and 8-bits block (i.e. Example 3), where we divide the S$_K$ into blocks and each block contains 2 bits in the first model, 4 bits in the second model and 8-bits in the third model respectively. This section will provide different scenarios for the generation of the Sh$_x$ to make the S$_K$ recovery mechanism easier to understand. Suppose, for an example, the S$_K$ has been chosen as S$_K$= (100111001001110010011100).  These models (2-bits block, 4-bits block, and 8-bits block) will produce ‘M’ shares Sh$_x$ by our method. Then, we have considered different test cases to reconstruct the S$_K$ with different numbers of secret shares, Sh$_x$. The test cases have been designed to use a specific threshold value, \texttt{k} that is needed to recover the S$_K$. 
These test cases consider the situation of reconstructing a S$_K$  by combining Sh$_x$ equal to \texttt{k} (i.e. Case A), by combining Sh$_x$ less than \texttt{k} (i.e. Case B), and by combining Sh$_x$ greater than \texttt{k} (i.e. Case C). 
%In the third example, we will choose a random secret key with expanded size=64 and block size=8 to generate the shares and test every scenario based on our algorithm.

In Table~\ref{tab:Shares Generation Using 2-bits Block-size}, we represent the 2-bits block model that attempts to generate secret shares Sh$_x$ with a goal to minimize the similarity among the Sh$_x$. In this 2-bits block example, the number of Sh$_x$ that are generated by our method is \texttt{12}. For exmaple, the Share~1 (Sh$_1$)  has been generated by XOR-ing the first block with the sequence of ``11", and this modification is done on the first two bits in the secret key S$_K$. The second share (Sh$_2$ ) is generated by modification the second two bits in the S$_K$ and so on. %untill we reach the last share the appear from making modification on  the last two bits in the  S$_K$. 
This approach provides a reasonable number of Sh$_x$ that can be used. But, the 2-bits block method still has limitation because of higher correlation between the generated Sh$_x$. As a result, it seems insecure because there remains some chance of identifying S$_K$ from the Sh$_x$. So, this model offers low level of security but high number of Sh$_x$ (high capacity).
\subsection{Example 1: Secret Shares Generation  with 2-bits block}
\begin{table}[h]
\centering
\caption{Shares Generation Using 2-bits Block-size}
\label{tab:Shares Generation Using 2-bits Block-size}
\begin{tabular}{|c|*{24}{c|}}
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh2 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh3 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh4 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh5 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh6 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh7 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh8 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh9&1&	0&	0&	1	&1&	1&	0&	0&	1	&0&	0	&1&	1	&1&	0&	0	&0&	1&	0&	1&	1&	1&	0&	0\\
\hline
sh10&	1&	0&	0&	1&	1&	1&	0&	0&	1&	0&	0&	1&	1	&1&	0&	0&	1	&0	&1&	0&	1&	1&	0&	0\\
\hline
sh11&	1&	0&	0&	1	&1	&1&	0	&0	&1	&0	&0&	1&	1	&1	&0	&0	&1	&0	&0	&1&	0	&0	&0&	0\\
\hline
sh12&	1&	0&	0	&1	&1	&1	&0	&0	&1	&0	&0	&1	&1	&1&	0	&0	&1	&0&	0	&1	&1	&1	&1&	1\\
\hline
\end{tabular}
\end{table}

In the test case shown in Table~\ref{tab:Shares Generation Using 2bits-Block when  N = k where k = 6}, we choose only 6 Sh$_x$ out of 12 to reconstruct the S$_k$. In this case, the number of Sh$_x$ is kept the same as the threshold value \texttt{k} and we have chosen the threshold value equal to 6 and the chosen shares are - Sh$_1$, Sh$_2$, Sh$_3$, Sh$_4$, Sh$_5$, and Sh$_6$. It is important to note that the same threshold value \texttt{k} also plays an important role while we constructed the secret shares Sh$_x$  from the  S$_K$. If there are a number of Sh$_x$  less than this threshold value we will be unable to reconstruct the  S$_K$. We have identified that if we try to reconstruct  S$_K$ by combining secret shares Sh$_x$ that are less than k, then  S$_K$ reconstruction process doesn’t become successful to provide the actual  S$_K$ (as shown in the next test case).

\subsubsection*{Case 1.A: Number of Shares Combined, N = k where k = 6}
\begin{table}[h]
\centering
\caption{%Table (4): 
Shares Generation Using 2bits-Block when  N = k where k = 6}
\label{tab:Shares Generation Using 2bits-Block when  N = k where k = 6}
\begin{tabular}{|c|*{24}{c|}}
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh2 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh3 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh4 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh5 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh6 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
Counting & 5 & 1 & 1 & 5 & 5 & 5 & 1 & 1 & 5 & 1 & 1 & 5 & 6 & 6 & 0 & 0 & 6 & 0 & 0 & 6 & 6 & 6 & 0 & 0 \\
\hline
SK & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 1& 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
\end{tabular}
\end{table}



\subsubsection*{Case 1.B: Number of Shares Combined, N $<$ k where k = 6}

In this case as shown in Table~\ref{tab:Shares Generation Using 2bits-Block when N $<$ k where k = 6}, we chose the number of Sh$_x$ as 4, and it is less than the threshold $(k)$. The chosen shares are - Sh$_1$, Sh$_2$, Sh$_3$, and Sh$_4$. Then after counting the number of ones in each column, we conclude that it is impossible to reconstruct S$_K$ because  the number of secret shares is less than the threshold value, k. 
\begin{table}[h]
\centering
\caption{%Table 5:  
Shares Generation Using 2bits-Block when N $<$ k where k = 6}
\label{tab:Shares Generation Using 2bits-Block when N $<$ k where k = 6}
\begin{tabular}{|l|*{24}{c|}}
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh2 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh3 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh4 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
Counting & 3 & 1 & 1 & 3 & 3 & 3 & 1 & 1 & 4 & 0 & 0 & 4 & 4 & 4 & 0 & 0 & 4 & 0 & 0 & 4 & 4 & 4 & 0 & 0 \\
\hline
SK & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
\hline
\end{tabular}
\end{table}



\subsubsection*{Case 1.C : Number of Shares Combined, N $>$ k where k = 6}

In Table~\ref{tab:Shares Generation Using 2bits-Block when  N $>$ k where k = 6}, we choose the number of shares greater than the threshold k and in this case we choose total 9 Sh$_x$ as Sh$_1$,Sh$_2$,Sh$_3$,Sh$_4$, Sh$_5$,Sh$_6$,Sh$_7$,Sh$_8$,and Sh$_9$. Again, we set the same threshold value for k and it is equal to 6. To reconstruct the secret key S$_K$ we counted the number of ones in each column and compare it with k. In this case we successfully reconstructed the S$_K$ and return each bit correctly. 
\begin{table}[h]
\centering
\caption{ Shares Generation Using 2bits-Block when  N $>$ k where k = 6}
\label{tab:Shares Generation Using 2bits-Block when  N $>$ k where k = 6}
\begin{tabular}{|l|*{24}{c|}}
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh2 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh3 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh4 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh5 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh6 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh7 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh8 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh9&	1&	0	&0	&1	&1	&1	&0	&0	&1&	0	&0	&1	&1&	1	&0&	0	&0	&1&	0	&1	&1	&1&	0	&0\\
\hline
Counting &	8&	1&	1&	8	&8	&8	&1&	1	&8&	1	&1&	8	&8&	9&	1&	1&	9	&1	&0	&9	&9	&9	&0	&0\\
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
\end{tabular}
\end{table}



\subsubsection*{Case 1.D : Attack involving False Share}

In this scenario, as shown in Table~\ref{tab:Shares Generation Using 2bits-Blocksize when intruder false share} we considered a false intruder share and the binary representation of the fake share was  1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 1 0. We test the case when we add a fake share, whether the secret key S$_K$ can be reconstructed correctly or not, and it can confirm the model security correctness. This case is considered unacceptable, where all shares are legal but the false one marked as False share. Thus, the output of the combination process is unacceptable as it failed to reconstruct S$_k$.
\begin{table}[h]
\centering
\caption{ Shares Generation Using 2bits-Blocksize when intruder false share}
\label{tab:Shares Generation Using 2bits-Blocksize when intruder false share}
\begin{tabular}{|l|*{24}{c|}}
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh1 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh2 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh3 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh4 & 1 & 0 & 0 & 1 & 1 & 1 & 1 & 1 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh5 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 0 & 1 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
sh6 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 1 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
False share&1&1&1&1&1&1&0&0&1&0&1&0&1&1&0&0&1&0&0&1&1&1&0&0\\
\hline 
Counting & 6 & 2 &2 & 6 & 6 & 6 & 1 & 1 & 6 & 1 & 2 & 5 & 7 & 7 & 0 & 0 & 7 & 0 & 0 & 7 & 7 & 7 & 0 & 0 \\
\hline
SK & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 0 & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 1 & 1 & 0 & 0 \\
\hline
\end{tabular}
\end{table}





\subsection{Example 2: Secret Shares Generation with 8-bits block}
%\hl{make this full section/example the same style/pattern as 2-bits block example above and make everything consistent}\\

In this section we extend the S$_K$ length to become 64 bits. The considered S$_K$ in hexadecimal is  (S$_K$= B2 35 6D 31 36 33 66 72) or in binary is  (S$_K$=10110010 00110101 01101101 00110001 00110110 00110011 01100110 01110010). %Additionally, this S$_K$ is used fairly in all previous studies to generate the different Sh$_x$ . In this section as shown 
In Table 11, we firstly generates the Sh$_x$ from this  S$_K$ by setting the block size as 8 bits. In this example, to generate different Sh$_x$, we apply XOR operation for each block with a sequence of ones equal to 11111111. The generated eight Sh$_x$ shares are Sh$_1$, Sh$_2$, Sh$_3$, Sh$_4$, Sh$_5$,  Sh$_6$, Sh$_7$, Sh$_8$. In Table~\ref{tab:Shares Generation Using 4-bits Block and with key size 64 bits}, the first share (Sh$_1$) is generated by modifying or XORing the first 8 bits with (11111111), and the second share (Sh$_2$) is generated by modifying the next 8 bits and so on until we reach the last 8-bits in S$_K$. 
 We then make different scenarios (shown below) to test the reconstruction of S$_K$. 

\begin{table}[h]
\centering
\caption{
Shares Generation Using 4-bits Block and with key size 64 bits}
\label{tab:Shares Generation Using 4-bits Block and with key size 64 bits}
\begin{tabular}{|l|l|}
\hline
SK & 10110010 00110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh1 & 0100110100110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh2 & 101100101100101001101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh3 & 10110010 001101011001001000110001 00110110 00110011 01100110 01110010 \\
\hline
Sh4 & 10110010 00110101 011011011100111000110110 00110011 01100110 01110010 \\
\hline
Sh5 & 10110010 00110101 01101101 001100011100100100110011 01100110 01110010 \\
\hline
Sh6 & 10110010 00110101 01101101 00110001 001101101100110001100110 01110010 \\
\hline
Sh7 & 10110010 00110101 01101101 00110001 00110110 001100111001100101110010 \\
\hline
Sh8 & 10110010 00110101 01101101 00110001 00110110 00110011 0110011010001101 \\
\hline
\end{tabular}
\end{table}
%In Table 12, we show the Sh$_x$ generation using  S$_K$ having the key size as 64 bits and the block size as 8 bits. .

\subsubsection*{Case 3.A : Number of Shares Combined, N $>$ \texttt{k} where k = 4}

In Table~\ref{tab:Situation of Combining Shares, N $>$ k where k = 4}, the S$_K$ size is 64 bits (as mentioned previously) and the block size is set to be 8 bits. The generated Sh$_x$ will be 8, but we have chosen only 5 (Sh$_1$,Sh$_2$,Sh$_3$,Sh$_4$, and  Sh$_5$) to reconstruct the S$_K$. In this case, we become successful in retrieving the S$_K$ by counting the number of ones in each coloumn and compare with the threshold value k. If the count of ones is greater than k, then we set the corresponding S$_K$ bit to 1; else we set the S$_K$ bit to 0.
\begin{table}[h]
\centering
\caption{Situation of Combining Shares, N $>$ k where k = 4 }
\label{tab:Situation of Combining Shares, N $>$ k where k = 4}
\begin{tabular}{|l|l|}
\hline
SK & 10110010 00110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh1 & 0100110100110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh2 & 101100101100101001101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh3 & 10110010 001101011001001000110001 00110110 00110011 01100110 01110010 \\
\hline
Sh4 & 10110010 00110101 011011011100111000110110 00110011 01100110 01110010 \\
\hline
Sh5 & 10110010 00110101 01101101001100011100100100110011 01100110 01110010 \\
SK & 1011001000110101011011010011000100110110001100110110011001110010 \\
\hline
\end{tabular}
\end{table}


\subsubsection*{Case 3.B : Number of Shares Combined, N $=$ \texttt{k} where k = 4}

Table~\ref{tab:Situation of Combining Shares, N $=$ k  where k = 4} shows that we choose the total Sh$_x$ equal to the number of threshold k where the value of k is set as 4. The Sh$_x$ that are chosen are Sh$_1$,Sh$_2$,Sh$_3$,Sh$_4$ but in this case, we didn’t able to retrieve the S$_K$ by combining Sh$_x$.
\begin{table}[h]
\centering
\caption{Situation of Combining Shares, N $=$ k  where k = 4}
\label{tab:Situation of Combining Shares, N $=$ k  where k = 4}
\begin{tabular}{|l|l|}
\hline
SK & 10110010 00110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh1 & 0100110100110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh2 & 101100101100101001101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh3 & 10110010 001101011001001000110001 00110110 00110011 01100110 01110010 \\
\hline
Sh4 & 10110010 00110101 011011011100111000110110 00110011 01100110 01110010 \\
\hline
Sk & 0000000000000000000000000000000000000000000000000000000000000000000 \\
\hline
\end{tabular}
\end{table}




\subsubsection*{Case 3.C: Number of Shares Combined, N $<$ \texttt{k} where k = 4}

Table~\ref{tab:Situation of Combining Shares, N $<$ k where k = 4} shows that we choose three share - Sh$_x$ (Sh$_1$,Sh$_2$, and Sh$_3$) where the number of Sh$_x$ is less than threshold k where the value of k is 4. The  S$_K$ reconstruction in this case is not successful and we are unable to retrieve the S$_K$ after Sh$_x$ generation.

\begin{table}[h]
\centering
\caption{Situation of Combining Shares, N $<$ k where k = 4}
\label{tab:Situation of Combining Shares, N $<$ k where k = 4}
\begin{tabular}{|l|l|}
\hline
SK & 10110010 00110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh1 & 0100110100110101 01101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh2 & 101100101100101001101101 00110001 00110110 00110011 01100110 01110010 \\
\hline
Sh3 & 10110010 001101011001001000110001 00110110 00110011 01100110 01110010 \\
\hline
Sk & 0000000000000000000000000000000000000000000000000000000000000000000 \\
\hline
\end{tabular}
\end{table}


The main purpose of creating these examples is to check the correctness of our algorithm based on different key sizes and with different block sizes. In all cases, our algorithm works well when the number of users is greater than the threshold then they will acccess the required file and modify it. 





















