little endian literal binary ascii 0 term. fix

* also some whitespace around the place
This commit is contained in:
citizen 2020-01-21 05:22:59 +01:00
parent b9a86c356e
commit 58a331ddba
Signed by: wanderer
GPG Key ID: A6FA3CA298BA2223

View File

@ -8,6 +8,7 @@ using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
@ -80,7 +81,7 @@ namespace KRY_0x02
string message = m;
int counter = 0;
int counterzero = 0;
byte[] letters_to_code = str_to_rev_binarray(m);
byte[] letters_to_code = str_to_rev_binarray(message);
string zero = "00001100";
@ -102,10 +103,10 @@ namespace KRY_0x02
blue_str = Convert.ToString(pixel.B, 2).PadLeft(8, '0');
blue_str_modded = blue_str.Substring(0, 7) + Convert.ToString(letters_to_code[counter]);
blue_int_modded = Convert.ToInt32(blue_str_modded, 2);
Console.WriteLine($"blueSTRmodded {blue_str_modded}");
Console.WriteLine($"blueINTmodded {blue_int_modded}");
Console.WriteLine($"blueSTRmodded {blue_str_modded}");
Console.WriteLine($"blueINTmodded {blue_int_modded}");
my_bitmap.SetPixel(j, i, Color.FromArgb(pixel.R, pixel.G, blue_int_modded));
Console.WriteLine(my_bitmap.GetPixel(i,j));
Console.WriteLine(my_bitmap.GetPixel(i, j));
counter++;
}
else
@ -161,7 +162,19 @@ namespace KRY_0x02
for (int i = 0; i < my_bool_array.Length / 8; i++)
{
BitArray my_bit_array = new BitArray(my_bool_array.Skip(i * 8).Take(8).ToArray());
Console.WriteLine(bit_array_to_byte(my_bit_array));
BitArray testifzero = new BitArray(8);
byte[] testifzeroarray = new byte[1];
for (int j = 0; j < 8; j++)
{
testifzero[j] = my_bit_array[my_bit_array.Length - j - 1];
}
testifzero.CopyTo(testifzeroarray, 0);
// little endian literal binary ascii 0
byte[] littleendianliteralbinaryasciizero = Encoding.UTF8.GetBytes("\u000C");
if (testifzeroarray[0] == littleendianliteralbinaryasciizero[0])
{
break;
}
char my_char = Convert.ToChar(Convert.ToInt32(bit_array_to_byte(my_bit_array)));
Console.WriteLine(my_char);
output += Convert.ToString(my_char);
@ -173,7 +186,8 @@ namespace KRY_0x02
//if (main_output != "")
//{
// output = main_output;
//}
//}
MessageBox.Show("success!","done");
return output;
}
}
@ -236,11 +250,11 @@ namespace KRY_0x02
}
textBox4height.Text = im_h.ToString();
textBox5width.Text = im_w.ToString();
textBox6capacity.Text = get_capacity(im_h,im_w).ToString();
textBox6capacity.Text = get_capacity(im_h, im_w).ToString();
}
}
}
private void button5_Click(object sender, EventArgs e)
{
/*/* use-default-pic button */
@ -260,12 +274,13 @@ namespace KRY_0x02
}
private void button6_Click(object sender, EventArgs e)
{
{
/*/**//**///* clear pic selection */
label5pathtopic.Text = @"path/to/pic";
pictureBox1.Image = null;
textBox3.Text = "";
path = "";
textBox2getm.Text = "";
textBox4height.Text = "";
textBox5width.Text = "";
textBox6capacity.Text = "";
@ -284,7 +299,7 @@ namespace KRY_0x02
return;
}
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
saveFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
saveFileDialog1.Title = "export your neatly stego-ed pic";
saveFileDialog1.CheckFileExists = false;
saveFileDialog1.CheckPathExists = false;
@ -295,8 +310,9 @@ namespace KRY_0x02
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
string name = saveFileDialog1.FileName;
pictureBox1.Image.Save($"{name}",ImageFormat.MemoryBmp);
MessageBox.Show($"saved to {name}","gj, file saved!");
Console.WriteLine($"attempted to save to: {name}");
pictureBox1.Image.Save($"{name}", ImageFormat.MemoryBmp);
MessageBox.Show($"saved to {name}", "gj, file saved!");
}
}
}