public Object stego(Bitmap im, String secret, Boolean whatDo) { Object returnObject = null; // [1] will contain the bitmap after embeded or extracted // all_NEW_Piexl_Stego = new int[myBitmap_Width * myBitmap_Height]; genaret_All_Pixel_Of_Bitmap(im); //************************************ index_OF_NEW_Stego_Pixel = 0; if (whatDo) { // if true do the Embeding Tsecret_Bits_All = toBinaryString(secret); int[] theInfo = embeding_Secret(); //returnObject[0] = theInfo[0]; the return number is mean how many pixel used //returnObject[1] = theInfo[1]; the return number is mean how bit in the last stego //returnObject[2] = theInfo[2]; the return number is mean where the stego stop color; int whathapend = theInfo[0]; // ********************* LSB STEGO ************************** String theSecretTOLSB = theInfo[0] + "," + theInfo[1] + "," + theInfo[2]; foreach (int[] c in theSkipColorPixels) { theSecretTOLSB += "," + c[0] + c[1]; } //MessageBox.Show("the LSB: " + theSecretTOLSB); theSecretTOLSB = toBinaryString(theSecretTOLSB); StegoLSB lsbStego = new StegoLSB(); lsbStego.stego(all_Piexl_Color, theSecretTOLSB); // ********************************************************** //MessageBox.Show("The Pixel Used For Stego is = " + ((int)returnObject[0]).ToString()); if (whathapend > 0) // this mean all secret are embeded in the image { //myBitmap.setPixels(all_Piexl_Color, 0, im.getWidth(), 0, 0, im.getWidth(), im.getHeight()); index_Of_All_Pixel_Color = 0; for (int i = 0; i < myBitmap_Height; i++) { for (int j = 0; j < myBitmap_Width; j++) { myBitmap.SetPixel(j, i, all_Piexl_Color[index_Of_All_Pixel_Color++]); } } returnObject = myBitmap; } else if (whathapend == -1) { // know will not do any thing because will return to the client } } // ******************************************** Extracting ************************************************************* else { // if false do the Extracting // ********************* Get The Secret Info From LSB For Get the Secret Stego In Image ********************* String[] theSplit; int pixel_num_used = 0; int theLastStegoBitsSize = 0; int theLastColorStego = 0; try { StegoLSB lsbStego = new StegoLSB(); String theSecretLSB = lsbStego.extract(all_Piexl_Color); theSplit = theSecretLSB.Split(','); pixel_num_used = int.Parse(theSplit[0]); theLastStegoBitsSize = int.Parse(theSplit[1]); theLastColorStego = int.Parse(theSplit[2]); for (int i = 3; i < theSplit.Length; i++) { int[] skip = new int[2]; skip[1] = int.Parse(theSplit[i][theSplit[i].Length - 1].ToString()); skip[0] = int.Parse(theSplit[i].Substring(0, theSplit[i].Length - 1)); theSkipColorPixels.Add(skip); } Tsecret_Bits_All = ""; returnObject = extracting_Secret(pixel_num_used, theLastStegoBitsSize, theLastColorStego); } catch (Exception e) { returnObject = null; } // ********************************************************************************************************** } // need to fill bitmap with all_NEW_Piexl_Stego Function will write return returnObject; }