<?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[Ausgeben von Zufallsbytes als Hexadezimal-Zahlen]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe ein Array aus unsigned chars, genaugenommen ist es ein Hashwert.<br />
Diesen Hashwert möchte ich jetzt als Hexadezimal-Zahl ausgeben.<br />
Der Hashwert ist 160 Bit lang, das unsigned char Array hat also 20 Elemente.<br />
Das Ganze soll jetzt in Hexadezimal konvertiert werden, eine Hexadezimalziffer hat 4 Bit informationen, also auf die Länge von 40 Ziffern.</p>
<p>Wie kann man das Lösen (ich glaube ich brauche nur einen Denkansatz)? Oder gibt es für sowas schon eine fertige Lösung? Ich würde QT verwenden, also ginge es auch wenn hier schon fertige Klassen verfügbar sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/188064/ausgeben-von-zufallsbytes-als-hexadezimal-zahlen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 25 Sep 2026 01:50:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/188064.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 26 Jul 2007 18:50:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ausgeben von Zufallsbytes als Hexadezimal-Zahlen on Thu, 26 Jul 2007 18:50:25 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe ein Array aus unsigned chars, genaugenommen ist es ein Hashwert.<br />
Diesen Hashwert möchte ich jetzt als Hexadezimal-Zahl ausgeben.<br />
Der Hashwert ist 160 Bit lang, das unsigned char Array hat also 20 Elemente.<br />
Das Ganze soll jetzt in Hexadezimal konvertiert werden, eine Hexadezimalziffer hat 4 Bit informationen, also auf die Länge von 40 Ziffern.</p>
<p>Wie kann man das Lösen (ich glaube ich brauche nur einen Denkansatz)? Oder gibt es für sowas schon eine fertige Lösung? Ich würde QT verwenden, also ginge es auch wenn hier schon fertige Klassen verfügbar sind.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1333291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1333291</guid><dc:creator><![CDATA[aXel3]]></dc:creator><pubDate>Thu, 26 Jul 2007 18:50:25 GMT</pubDate></item><item><title><![CDATA[Reply to Ausgeben von Zufallsbytes als Hexadezimal-Zahlen on Thu, 26 Jul 2007 19:50:39 GMT]]></title><description><![CDATA[<p>naja in qt kann QString nahezu alles, was du brauchst. du kannst bei arg() angeben, welche zahlenbasis du haben willst.<br />
qt-code:</p>
<pre><code class="language-cpp">QString zufall2hex(unsigned char daten[20])
{
  QString hex;
  for (int i=19;i&gt;=0;i--)
    hex+=QString(%1).arg(int(daten[i]),0,16);
  return hex;
}
</code></pre>
<p>in standard-c++:</p>
<pre><code class="language-cpp">string zufall2hex(unsigned char daten[20])
{
   stringstream str;
   str.setf(ios_base::hex,ios_base::basefield);
   for (int i=19;i&gt;=0;i--)
        str &lt;&lt; int(daten[i]);
   return str.str();
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1333349</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1333349</guid><dc:creator><![CDATA[ghorst]]></dc:creator><pubDate>Thu, 26 Jul 2007 19:50:39 GMT</pubDate></item><item><title><![CDATA[Reply to Ausgeben von Zufallsbytes als Hexadezimal-Zahlen on Fri, 27 Jul 2007 10:41:06 GMT]]></title><description><![CDATA[<p>Super!</p>
<p>Hätte nicht gedacht, dass man ein unsigned char so einfach in int konvertieren kann <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/1333835</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1333835</guid><dc:creator><![CDATA[aXel3]]></dc:creator><pubDate>Fri, 27 Jul 2007 10:41:06 GMT</pubDate></item></channel></rss>