<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Steganograph]]></title><description><![CDATA[<p>Ich progge grade meinen Steganograph, aber schaffe es nicht, die niedrigen Bits einer unsigned int Variable zu manipulieren.</p>
<p>unsigned char c;<br />
unsigned int pC;<br />
--&gt; pC ist in wirklichkeit ein Array, das die Farbwerte enthält</p>
<p>Wie kann ich mit c den letzten Byte von pC überschreiben?</p>
<p>und wie kann ich c wieder auslesen?</p>
<pre><code>Byte:
7 6 5 4 3 2 1 0
---------------
              |
              c
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/134127/steganograph</link><generator>RSS for Node</generator><lastBuildDate>Sat, 29 Aug 2026 00:09:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/134127.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 23 Jan 2006 20:47:16 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 20:51:36 GMT]]></title><description><![CDATA[<p>Ich progge grade meinen Steganograph, aber schaffe es nicht, die niedrigen Bits einer unsigned int Variable zu manipulieren.</p>
<p>unsigned char c;<br />
unsigned int pC;<br />
--&gt; pC ist in wirklichkeit ein Array, das die Farbwerte enthält</p>
<p>Wie kann ich mit c den letzten Byte von pC überschreiben?</p>
<p>und wie kann ich c wieder auslesen?</p>
<pre><code>Byte:
7 6 5 4 3 2 1 0
---------------
              |
              c
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/974329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974329</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Mon, 23 Jan 2006 20:51:36 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 21:00:44 GMT]]></title><description><![CDATA[<p>Ich glaube, dass was du meinst, geht mit einem reinterpret_cast:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;

int main(int argc, char *argv[])
{
    unsigned int Zahl = 123;
    unsigned char Byte = 2;
    *(reinterpret_cast&lt;unsigned char*&gt;(&amp;Zahl) + 3) = Byte; // hier der vierte byte
    // das ganze dann so gezählz, dass 0 der byte ist, der bei dir 7 ist.
    std::cout &lt;&lt; Zahl;
    system(&quot;PAUSE&quot;);
    return EXIT_SUCCESS;
}
</code></pre>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974364</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974364</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Mon, 23 Jan 2006 21:00:44 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 21:11:52 GMT]]></title><description><![CDATA[<p>Kommt zum Absturz...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974400</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974400</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Mon, 23 Jan 2006 21:11:52 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 21:30:53 GMT]]></title><description><![CDATA[<p>War mein Fehler...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974450</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974450</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Mon, 23 Jan 2006 21:30:53 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 21:32:13 GMT]]></title><description><![CDATA[<p>Und wie bekomme ich meinen char Wert wieder heraus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974453</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974453</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Mon, 23 Jan 2006 21:32:13 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Mon, 23 Jan 2006 22:14:00 GMT]]></title><description><![CDATA[<p>Tc++H schrieb:</p>
<blockquote>
<p>Und wie bekomme ich meinen char Wert wieder heraus?</p>
</blockquote>
<p>Hallo,<br />
Ich verstehe nicht ganz, warum man hier einen reinterpret_cast&lt;&gt;() verwendet... Geht doch viel einfacher und schöner mit einfachen Bitmanipulationen.</p>
<p>Beispiel:</p>
<pre><code class="language-cpp">unsigned int i = 512; // bitmuster: 00000000 00000000 00000010 00000000
unsigned char c = 16; // bitmuster: 00010000

// Letztes Byte eines Ints mit den Bits eines Char-Werts überschreiben.
unsigned int out = i | c; // out enthält den Wert 528, denn bitmuster: 00000000 00000000 00000010 00010000

// Letztes Byte aus dem Int wieder herstellen:
unsigned int out = i &amp; 0xFF; // out enthält den Wert 16, denn bitmuster: 00010000
</code></pre>
<p>Gruß Caipi</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974504</guid><dc:creator><![CDATA[Caipi]]></dc:creator><pubDate>Mon, 23 Jan 2006 22:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Tue, 24 Jan 2006 05:27:23 GMT]]></title><description><![CDATA[<p>genau... sowas brauchte ich...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974562</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Tue, 24 Jan 2006 05:27:23 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Tue, 24 Jan 2006 05:34:31 GMT]]></title><description><![CDATA[<p>Kennt jemand eine gute Beschreibung zu den BItmanipulatoren?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974563</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Tue, 24 Jan 2006 05:34:31 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Tue, 24 Jan 2006 07:55:03 GMT]]></title><description><![CDATA[<p>Caipi schrieb:</p>
<blockquote>
<p>Tc++H schrieb:</p>
<blockquote>
<p>Und wie bekomme ich meinen char Wert wieder heraus?</p>
</blockquote>
<p>Hallo,<br />
Ich verstehe nicht ganz, warum man hier einen reinterpret_cast&lt;&gt;() verwendet... Geht doch viel einfacher und schöner mit einfachen Bitmanipulationen.</p>
<p>Beispiel:</p>
<pre><code class="language-cpp">unsigned int i = 512; // bitmuster: 00000000 00000000 00000010 00000000
unsigned char c = 16; // bitmuster: 00010000

// Letztes Byte eines Ints mit den Bits eines Char-Werts überschreiben.
unsigned int out = i | c; // out enthält den Wert 528, denn bitmuster: 00000000 00000000 00000010 00010000

// Letztes Byte aus dem Int wieder herstellen:
unsigned int out = i &amp; 0xFF; // out enthält den Wert 16, denn bitmuster: 00010000
</code></pre>
<p>Gruß Caipi</p>
</blockquote>
<p>Aber das geht ja jetzt nur für den letzten Byte, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974654</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974654</guid><dc:creator><![CDATA[aasd]]></dc:creator><pubDate>Tue, 24 Jan 2006 07:55:03 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Tue, 24 Jan 2006 08:22:59 GMT]]></title><description><![CDATA[<p>Für die höherwertigen Bytes mußt du c entsprechend weit nach links shiften (dann rechnest du mit c&lt;&lt;n*8 (n-Position im int).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/974673</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/974673</guid><dc:creator><![CDATA[CStoll (off)]]></dc:creator><pubDate>Tue, 24 Jan 2006 08:22:59 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Tue, 24 Jan 2006 16:23:41 GMT]]></title><description><![CDATA[<p>Ich habe noch ein kleines Problem mit der Bitmap speicherfunktion...<br />
Und zwar speichert er die Bitmap in ner falschen Farbe... aber lädt sie richtig, ich habe sie mal ausgegeben mit Hilfe der WinAPI<br />
Statt GetXValue(...) würde ich auch lieber Bitmanipulatoren verwenden</p>
<pre><code class="language-cpp">#pragma  pack(1)
struct BMFH // BitmapFileHeader
{
	char         bmtype[2];     // 2 bytes - 'B' 'M'
	unsigned int iFileSize;     // 4 bytes
	short int    reserved1;     // 2 bytes
	short int    reserved2;     // 2 bytes
	unsigned int iOffsetBits;   // 4 bytes

};
#pragma pack()

#pragma pack(1)
struct BMIF // BitmapInfoHeader
{
	unsigned int iSizeHeader;    // 4 bytes - 40
	unsigned int iWidth;         // 4 bytes
	unsigned int iHeight;        // 4 bytes
	short int    iPlanes;        // 2 bytes
	short int    iBitCount;      // 2 bytes
	unsigned int Compression;    // 4 bytes
	unsigned int iSizeImage;     // 4 bytes
	unsigned int iXPelsPerMeter; // 4 bytes
	unsigned int iYPelsPerMeter; // 4 bytes
	unsigned int iClrUsed;       // 4 bytes
	unsigned int iClrImportant;  // 4 bytes
};// End of stBMIF structure - size 40 bytes
#pragma pack()

struct Image
{
	unsigned int iWidth;
	unsigned int iHeight;
	unsigned int* pARGB; // Alpha Red Green Blue
};

...
std::basic_fstream&lt;char&gt; in(&quot;test1.bmp&quot;, std::ios_base::in | std::ios_base::binary);
if(!in)
return -1;

BMFH bMFH;
BMIF bMIF;

in.read((char*) &amp;bMFH, sizeof(BMFH));
in.read((char*) &amp;bMIF, sizeof(BMIF));

Image img;
img.iWidth  = bMIF.iWidth;
img.iHeight = bMIF.iHeight;
img.pARGB	= new(unsigned int[img.iWidth * img.iHeight]);

int iNumPaddedBytes = (img.iWidth * 3) % 4;

in.seekp(bMFH.iOffsetBits);
for(unsigned int h = 0; h &lt; img.iHeight; h ++)
{
	for(unsigned int w = 0; w &lt; img.iWidth; w ++)
	{
		unsigned char r, g, b;

		in.read((char*) &amp;b, sizeof(char));
		in.read((char*) &amp;g, sizeof(char));
		in.read((char*) &amp;r, sizeof(char));

		img.pARGB[w + h * img.iWidth] = (r &lt;&lt; 16 | g &lt;&lt; 8 | b);
	}

	if(iNumPaddedBytes != 0)
	{
		unsigned char skip[4];
		in.read((char*) &amp;skip, sizeof(skip));
	}
}

//////////////////////////////////////////////////////////////////////////////
// Speichern
std::basic_fstream&lt;char&gt; out(&quot;test3.bmp&quot;, std::ios_base::out | std::ios_base::binary);
out.write((char*) &amp;bMFH, sizeof(BMFH));
out.write((char*) &amp;bMIF, sizeof(BMIF));

unsigned char r, g, b;
for(unsigned int h = 0; h &lt; img.iHeight; h ++)
{
	for(unsigned int w = 0; w &lt; img.iWidth; w ++)
	{
		r  = img.pARGB[w + h * img.iWidth] = GetRValue(img.pARGB[w + h * img.iWidth]);
		g  = img.pARGB[w + h * img.iWidth] = GetGValue(img.pARGB[w + h * img.iWidth]);
		b  = img.pARGB[w + h * img.iWidth] = GetBValue(img.pARGB[w + h * img.iWidth]);

		out.write((char*) &amp;r, sizeof(char));
		out.write((char*) &amp;g, sizeof(char));
		out.write((char*) &amp;b, sizeof(char));

	}
}

delete[](img.pARGB);
...
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/975119</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/975119</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Tue, 24 Jan 2006 16:23:41 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Wed, 25 Jan 2006 20:22:01 GMT]]></title><description><![CDATA[<p>Kann mir jemand helfen, wie man eine Bitmap speichert?? und acu effizient lädt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/976369</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976369</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Wed, 25 Jan 2006 20:22:01 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Wed, 25 Jan 2006 20:27:15 GMT]]></title><description><![CDATA[<p>Tc++H schrieb:</p>
<blockquote>
<p>Kann mir jemand helfen, wie man eine Bitmap speichert?? und acu effizient lädt?</p>
</blockquote>
<p>Jo, ich hab gerade im anderem Beitrag beim WinAPI Forum geantwortet.</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/976374</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/976374</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Wed, 25 Jan 2006 20:27:15 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Thu, 02 Feb 2006 15:45:25 GMT]]></title><description><![CDATA[<p>Ich habe es mal mit den Bitmanipulatoren getestet aber es funktioniert nicht... bei mir kommt nicht 16, sonder 0 raus.</p>
<pre><code class="language-cpp">int main()
{
	unsigned int i = 512;
	unsigned char c = 16;
	unsigned out1 = i | c;
	cout &lt;&lt; out1 &lt;&lt; endl;

	unsigned int out2 = i &amp; 0xff;
	cout &lt;&lt; out2;

	char a;
	cin &gt;&gt; a;
	return 0;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/984098</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984098</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Thu, 02 Feb 2006 15:45:25 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Thu, 02 Feb 2006 16:28:03 GMT]]></title><description><![CDATA[<p>Wo soll hier 16 rauskommen?<br />
Bei out1 muss 528 und bei out2 0 rauskommen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984162</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984162</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Thu, 02 Feb 2006 16:28:03 GMT</pubDate></item><item><title><![CDATA[Reply to Steganograph on Thu, 02 Feb 2006 17:07:48 GMT]]></title><description><![CDATA[<p>Ja, ich habe was falsch gemacht, mein Fehler.</p>
<p>Aber ich habe noch ein andres Prob: Warum darf i nur 512 oder 1024 betragen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/984217</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/984217</guid><dc:creator><![CDATA[Tc++H]]></dc:creator><pubDate>Thu, 02 Feb 2006 17:07:48 GMT</pubDate></item></channel></rss>