<?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[Zufällige zahl mit bit-beschränkung]]></title><description><![CDATA[<p>hallo.</p>
<p>für einen sicherheitsalgorithmus brauche ich eine zufallszahl, die eine bestimmte größe maximal haben darf, also beispielsweise 512 bit.<br />
Wie kann ich dies möglichst effizient lösen ( die funktion wird sehr oft aufgerufen werden.)<br />
ich dachte an ein array aus (zufällig gewählten) 1 und 0en, welches ich auf die gewählte bitzahl beschränke und dann in einen int umforme.</p>
<p>doch: ist das effizient oder gibt es noch bessere lösungen für ein solches problem?</p>
<p>viele grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/216786/zufällige-zahl-mit-bit-beschränkung</link><generator>RSS for Node</generator><lastBuildDate>Sun, 11 Oct 2026 01:31:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/216786.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 28 Jun 2008 13:18:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 13:18:14 GMT]]></title><description><![CDATA[<p>hallo.</p>
<p>für einen sicherheitsalgorithmus brauche ich eine zufallszahl, die eine bestimmte größe maximal haben darf, also beispielsweise 512 bit.<br />
Wie kann ich dies möglichst effizient lösen ( die funktion wird sehr oft aufgerufen werden.)<br />
ich dachte an ein array aus (zufällig gewählten) 1 und 0en, welches ich auf die gewählte bitzahl beschränke und dann in einen int umforme.</p>
<p>doch: ist das effizient oder gibt es noch bessere lösungen für ein solches problem?</p>
<p>viele grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537461</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537461</guid><dc:creator><![CDATA[just-another-programmer]]></dc:creator><pubDate>Sat, 28 Jun 2008 13:18:14 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 13:26:23 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/stl/bitset/" rel="nofollow">http://www.cplusplus.com/reference/stl/bitset/</a></p>
<p>Wäre ein passender Container dazu. Obwohl,wenn du beschränkst ein Array auch recht gut geht.</p>
<p>Aber ich frage mich, was du mit einer 512 Bit Zahl anfangen willst. In einen int bringst du die nicht. (int hat (meist) 32 Bit).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537465</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 28 Jun 2008 13:26:23 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 13:29:31 GMT]]></title><description><![CDATA[<p>hallo</p>
<p>ja ich weiß, dass das wohl kaum noch in einen int reinpassen wird^^</p>
<p>ich wollte damit eine verschlüsslung schreiben. netzwerkübertragung. datenversand nur über verschlüsslung. da dachte ich, je höher, desto besser.</p>
<p>natürlich lasse ich mich gern eines besseren belehren^^</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537468</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537468</guid><dc:creator><![CDATA[just-another-programmer]]></dc:creator><pubDate>Sat, 28 Jun 2008 13:29:31 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 13:32:29 GMT]]></title><description><![CDATA[<p>just-another-programmer schrieb:</p>
<blockquote>
<p>hallo</p>
<p>ja ich weiß, dass das wohl kaum noch in einen int reinpassen wird^^</p>
<p>ich wollte damit eine verschlüsslung schreiben. netzwerkübertragung. datenversand nur über verschlüsslung. da dachte ich, je höher, desto besser.</p>
<p>natürlich lasse ich mich gern eines besseren belehren^^</p>
<p>grüße</p>
</blockquote>
<p>Also wenn du das zum lernen/ausprobieren machst, bastle ein wenig damit rum. Wenn du es wirklich sicher haben willst, nimm eine fertige lib. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537470</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537470</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 28 Jun 2008 13:32:29 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 13:34:22 GMT]]></title><description><![CDATA[<p>drakon schrieb:</p>
<blockquote>
<p>Wenn du es wirklich sicher haben willst, nimm eine fertige lib. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>wie zum beispiel? :&gt;</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537472</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537472</guid><dc:creator><![CDATA[just-another-programmer]]></dc:creator><pubDate>Sat, 28 Jun 2008 13:34:22 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 14:19:30 GMT]]></title><description><![CDATA[<p>Hier:</p>
<pre><code class="language-cpp">int main () {  

	srand(time(0));
	const size_t keySize = 100000;
	std::vector&lt;char&gt; key(keySize);
	for(size_t i = 0; i&lt;keySize; i++) {
		key[i]=rand()%255;
	}

	std::string text=&quot;bal text zum verschicken...&quot;;
	std::vector&lt;char&gt; crypted(text.length());
	size_t k = 0;
	for(size_t i = 0; i&lt;text.length(); i++) {
		crypted[i]=text[i]^key[k++];
		k%=keySize;
	}

    return 0;
}
</code></pre>
<p>Kann keiner entschlüsseln, musst nur den Schlüssel sicher übertragen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537492</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537492</guid><dc:creator><![CDATA[cryptoCoder2000]]></dc:creator><pubDate>Sat, 28 Jun 2008 14:19:30 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 14:51:18 GMT]]></title><description><![CDATA[<p>just-another-programmer schrieb:</p>
<blockquote>
<p>drakon schrieb:</p>
<blockquote>
<p>Wenn du es wirklich sicher haben willst, nimm eine fertige lib. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>wie zum beispiel? :&gt;</p>
</blockquote>
<p>der klassiker: libcrypt (<a href="http://sourceforge.net/projects/libcrypt/" rel="nofollow">http://sourceforge.net/projects/libcrypt/</a> )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537505</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537505</guid><dc:creator><![CDATA[ghorst]]></dc:creator><pubDate>Sat, 28 Jun 2008 14:51:18 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sat, 28 Jun 2008 14:51:27 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f44d.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--thumbs_up"
      title=":+1:"
      alt="👍"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537506</guid><dc:creator><![CDATA[Kenner der Witze]]></dc:creator><pubDate>Sat, 28 Jun 2008 14:51:27 GMT</pubDate></item><item><title><![CDATA[Reply to Zufällige zahl mit bit-beschränkung on Sun, 29 Jun 2008 05:06:50 GMT]]></title><description><![CDATA[<p>gute Kryptobibliothek in C++ ist die <a href="http://www.cryptopp.com" rel="nofollow">crypto++</a><br />
Ist stark Template basierend, sind natürlich auch entsprechende Zufallszahlengeneratoren implementiert wie z.B. der BBS (Blum-Blum-Shub) und viele mehr</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1537752</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1537752</guid><dc:creator><![CDATA[zorni]]></dc:creator><pubDate>Sun, 29 Jun 2008 05:06:50 GMT</pubDate></item></channel></rss>