<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://stratum0.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Spacegate%2F1.Crap</id>
	<title>Spacegate/1.Crap - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://stratum0.org/mediawiki/index.php?action=history&amp;feed=atom&amp;title=Spacegate%2F1.Crap"/>
	<link rel="alternate" type="text/html" href="https://stratum0.org/mediawiki/index.php?title=Spacegate/1.Crap&amp;action=history"/>
	<updated>2026-04-21T17:45:09Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Stratum 0</subtitle>
	<generator>MediaWiki 1.31.2</generator>
	<entry>
		<id>https://stratum0.org/mediawiki/index.php?title=Spacegate/1.Crap&amp;diff=3202&amp;oldid=prev</id>
		<title>DooMMasteR am 11. April 2012 um 18:06 Uhr</title>
		<link rel="alternate" type="text/html" href="https://stratum0.org/mediawiki/index.php?title=Spacegate/1.Crap&amp;diff=3202&amp;oldid=prev"/>
		<updated>2012-04-11T18:06:09Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;de&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Nächstältere Version&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Version vom 11. April 2012, 18:06 Uhr&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot; &gt;Zeile 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Zeile 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;1. Implementation von SHA256 inkl. UART gelaber (noch mit human Stuff)&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;1. Implementation von SHA256 inkl. UART gelaber (noch mit human Stuff)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;C++&lt;/del&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;cpp&lt;/ins&gt;&amp;quot;&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;sha256.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#include &amp;lt;sha256.h&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#define LITTLE_ENDIAN&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;#define LITTLE_ENDIAN&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key mediawiki_stratum0-mw_:diff::1.12:old-3201:rev-3202 --&gt;
&lt;/table&gt;</summary>
		<author><name>DooMMasteR</name></author>
		
	</entry>
	<entry>
		<id>https://stratum0.org/mediawiki/index.php?title=Spacegate/1.Crap&amp;diff=3201&amp;oldid=prev</id>
		<title>DooMMasteR: Die Seite wurde neu angelegt: „1. Implementation von SHA256 inkl. UART gelaber (noch mit human Stuff)  &lt;syntaxhighlight lang=&quot;C++&quot;&gt; #include &lt;sha256.h&gt; #define LITTLE_ENDIAN  uint8_t summed[…“</title>
		<link rel="alternate" type="text/html" href="https://stratum0.org/mediawiki/index.php?title=Spacegate/1.Crap&amp;diff=3201&amp;oldid=prev"/>
		<updated>2012-04-11T18:05:39Z</updated>

		<summary type="html">&lt;p&gt;Die Seite wurde neu angelegt: „1. Implementation von SHA256 inkl. UART gelaber (noch mit human Stuff)  &amp;lt;syntaxhighlight lang=&amp;quot;C++&amp;quot;&amp;gt; #include &amp;lt;sha256.h&amp;gt; #define LITTLE_ENDIAN  uint8_t summed[…“&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;1. Implementation von SHA256 inkl. UART gelaber (noch mit human Stuff)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C++&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;sha256.h&amp;gt;&lt;br /&gt;
#define LITTLE_ENDIAN&lt;br /&gt;
&lt;br /&gt;
uint8_t summed[32];&lt;br /&gt;
char input[32];&lt;br /&gt;
int poscnt = 0;&lt;br /&gt;
byte recdata;&lt;br /&gt;
&lt;br /&gt;
void setup() {&lt;br /&gt;
  // put your setup code here, to run once:&lt;br /&gt;
  Serial.begin(9600);&lt;br /&gt;
  Serial.println(&amp;quot;Input&amp;quot;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void serialEvent() {&lt;br /&gt;
  recdata = Serial.read();&lt;br /&gt;
  if (recdata == 0x0D &amp;amp;&amp;amp; poscnt == 0) {&lt;br /&gt;
    Serial.println();&lt;br /&gt;
    Serial.println(&amp;quot;Input&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  if (poscnt &amp;gt;=32 || recdata == 0x0D) {&lt;br /&gt;
    Serial.println();&lt;br /&gt;
    Serial.print(&amp;quot;Received: &amp;quot;);&lt;br /&gt;
    Serial.println(input);&lt;br /&gt;
    sha256(&amp;amp;summed, input, poscnt*8);&lt;br /&gt;
    Serial.print(&amp;quot;SHA256: &amp;quot;);&lt;br /&gt;
    for (int i = 0; i &amp;lt;= 31; i++) {&lt;br /&gt;
      Serial.print(summed[i], HEX);&lt;br /&gt;
      input[i] = NULL;&lt;br /&gt;
    }&lt;br /&gt;
    Serial.println();&lt;br /&gt;
    poscnt = 0;&lt;br /&gt;
    Serial.print(&amp;quot;Input&amp;quot;);&lt;br /&gt;
  }&lt;br /&gt;
  else {&lt;br /&gt;
    input[poscnt] = recdata;&lt;br /&gt;
    Serial.println(input);&lt;br /&gt;
    poscnt++;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void loop() {&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// AVR crypto lib&lt;br /&gt;
uint32_t sha256_init_vector[]={&lt;br /&gt;
  0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,&lt;br /&gt;
  0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 };&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * \brief \c sh256_init initialises a sha256 context for hashing.&lt;br /&gt;
 * \c sh256_init c initialises the given sha256 context for hashing&lt;br /&gt;
 * @param state pointer to a sha256 context&lt;br /&gt;
 * @return none&lt;br /&gt;
 */&lt;br /&gt;
void sha256_init(sha256_ctx_t *state){&lt;br /&gt;
  state-&amp;gt;length=0;&lt;br /&gt;
  memcpy(state-&amp;gt;h, sha256_init_vector, 8*4);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * rotate x right by n positions&lt;br /&gt;
 */&lt;br /&gt;
uint32_t rotr32( uint32_t x, uint8_t n){&lt;br /&gt;
  return ((x&amp;gt;&amp;gt;n) | (x&amp;lt;&amp;lt;(32-n)));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
// #define CHANGE_ENDIAN32(x) (((x)&amp;lt;&amp;lt;24) | ((x)&amp;gt;&amp;gt;24) | (((x)&amp;amp; 0x0000ff00)&amp;lt;&amp;lt;8) | (((x)&amp;amp; 0x00ff0000)&amp;gt;&amp;gt;8))&lt;br /&gt;
&lt;br /&gt;
uint32_t change_endian32(uint32_t x){&lt;br /&gt;
  return (((x)&amp;lt;&amp;lt;24) | ((x)&amp;gt;&amp;gt;24) | (((x)&amp;amp; 0x0000ff00)&amp;lt;&amp;lt;8) | (((x)&amp;amp; 0x00ff0000)&amp;gt;&amp;gt;8));&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/* sha256 functions as macros for speed and size, cause they are called only once */&lt;br /&gt;
&lt;br /&gt;
#define CH(x,y,z)  (((x)&amp;amp;(y)) ^ ((~(x))&amp;amp;(z)))&lt;br /&gt;
#define MAJ(x,y,z) (((x)&amp;amp;(y)) ^ ((x)&amp;amp;(z)) ^ ((y)&amp;amp;(z)))&lt;br /&gt;
&lt;br /&gt;
#define SIGMA0(x) (rotr32((x),2) ^ rotr32((x),13) ^ rotr32((x),22))&lt;br /&gt;
#define SIGMA1(x) (rotr32((x),6) ^ rotr32((x),11) ^ rotr32((x),25))&lt;br /&gt;
#define SIGMA_a(x) (rotr32((x),7)  ^ rotr32((x),18) ^ ((x)&amp;gt;&amp;gt;3))&lt;br /&gt;
#define SIGMA_b(x) (rotr32((x),17) ^ rotr32((x),19) ^ ((x)&amp;gt;&amp;gt;10))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
uint32_t k[]={&lt;br /&gt;
  0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,&lt;br /&gt;
  0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,&lt;br /&gt;
  0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,&lt;br /&gt;
  0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,&lt;br /&gt;
  0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,&lt;br /&gt;
  0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,&lt;br /&gt;
  0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,&lt;br /&gt;
  0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * block must be, 512, Bit = 64, Byte, long !!!&lt;br /&gt;
 */&lt;br /&gt;
void sha256_nextBlock (sha256_ctx_t *state, const void* block){&lt;br /&gt;
  uint32_t w[64]; 	/* this is 256, byte, large, */&lt;br /&gt;
  uint8_t  i;&lt;br /&gt;
  uint32_t a[8],t1,t2;&lt;br /&gt;
&lt;br /&gt;
  /* init w */&lt;br /&gt;
#if defined LITTLE_ENDIAN&lt;br /&gt;
  for (i=0; i&amp;lt;16; ++i){&lt;br /&gt;
    w[i]= change_endian32(((uint32_t*)block)[i]);&lt;br /&gt;
  }&lt;br /&gt;
#elif defined BIG_ENDIAN&lt;br /&gt;
  memcpy((void*)w, block, 64);&lt;br /&gt;
#endif&lt;br /&gt;
  for (i=16; i&amp;lt;64; ++i){&lt;br /&gt;
    w[i] = SIGMA_b(w[i-2]) + w[i-7] + SIGMA_a(w[i-15]) + w[i-16];&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  /* init working variables */&lt;br /&gt;
  memcpy((void*)a,(void*)(state-&amp;gt;h), 8*4);&lt;br /&gt;
&lt;br /&gt;
  /* do the, fun stuff, */&lt;br /&gt;
  for (i=0; i&amp;lt;64; ++i){&lt;br /&gt;
    t1 = a[7] + SIGMA1(a[4]) + CH(a[4],a[5],a[6]) + k[i] + w[i];&lt;br /&gt;
    t2 = SIGMA0(a[0]) + MAJ(a[0],a[1],a[2]);&lt;br /&gt;
    memmove(&amp;amp;(a[1]), &amp;amp;(a[0]), 7*4); 	/* a[7]=a[6]; a[6]=a[5]; a[5]=a[4]; a[4]=a[3]; a[3]=a[2]; a[2]=a[1]; a[1]=a[0]; */&lt;br /&gt;
    a[4] += t1;&lt;br /&gt;
    a[0] = t1 + t2;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  /* update, the, state, */&lt;br /&gt;
  for (i=0; i&amp;lt;8; ++i){&lt;br /&gt;
    state-&amp;gt;h[i] += a[i];&lt;br /&gt;
  }&lt;br /&gt;
  state-&amp;gt;length += 512;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/**&lt;br /&gt;
 * \brief function to process the last block being hashed&lt;br /&gt;
 * @param state Pointer to the context in which this block should be processed.&lt;br /&gt;
 * @param block Pointer to the message wich should be hashed.&lt;br /&gt;
 * @param length is the length of only THIS block in BITS not in bytes!&lt;br /&gt;
 *  bits are big endian, meaning high bits come first.&lt;br /&gt;
 * 	if you have a message with bits at the end, the byte must be padded with zeros&lt;br /&gt;
 */&lt;br /&gt;
void sha256_lastBlock(sha256_ctx_t *state, const void* block, uint16_t length){&lt;br /&gt;
  uint8_t lb[SHA256_BLOCK_BITS/8]; /* local block */&lt;br /&gt;
  while(length&amp;gt;=SHA256_BLOCK_BITS){&lt;br /&gt;
    sha256_nextBlock(state, block);&lt;br /&gt;
    length -= SHA256_BLOCK_BITS;&lt;br /&gt;
    block = (uint8_t*)block+SHA256_BLOCK_BYTES;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  state-&amp;gt;length += length;&lt;br /&gt;
  memcpy (&amp;amp;(lb[0]), block, length/8);&lt;br /&gt;
&lt;br /&gt;
  /* set the final one bit */&lt;br /&gt;
  if (length &amp;amp; 0x7){ // if we have single bits at the end&lt;br /&gt;
    lb[length/8] = ((uint8_t*)(block))[length/8];&lt;br /&gt;
  } &lt;br /&gt;
  else {&lt;br /&gt;
    lb[length/8] = 0;&lt;br /&gt;
  }&lt;br /&gt;
  lb[length/8] |= 0x80&amp;gt;&amp;gt;(length &amp;amp; 0x7);&lt;br /&gt;
  length =(length &amp;gt;&amp;gt; 3) + 1; /* from now on length contains the number of BYTES in lb*/&lt;br /&gt;
  /* pad with zeros */&lt;br /&gt;
  if (length&amp;gt;64-8){ /* not enouth space for 64bit length value */&lt;br /&gt;
    memset((void*)(&amp;amp;(lb[length])), 0, 64-length);&lt;br /&gt;
    sha256_nextBlock(state, lb);&lt;br /&gt;
    state-&amp;gt;length -= 512;&lt;br /&gt;
    length = 0;&lt;br /&gt;
  }&lt;br /&gt;
  memset((void*)(&amp;amp;(lb[length])), 0, 56-length);&lt;br /&gt;
  /* store the 64bit length value */&lt;br /&gt;
#if defined LITTLE_ENDIAN&lt;br /&gt;
  /* this is now rolled up */&lt;br /&gt;
  uint8_t i;&lt;br /&gt;
  for (i=1; i&amp;lt;=8; ++i){&lt;br /&gt;
    lb[55+i] = (uint8_t)(state-&amp;gt;length&amp;gt;&amp;gt;(64- 8*i));&lt;br /&gt;
  }&lt;br /&gt;
#elif defined BIG_ENDIAN&lt;br /&gt;
  *((uint64_t)&amp;amp;(lb[56])) = state-&amp;gt;length;&lt;br /&gt;
#endif&lt;br /&gt;
  sha256_nextBlock(state, lb);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
 * length in bits!&lt;br /&gt;
 */&lt;br /&gt;
void sha256(sha256_hash_t *dest, const void* msg, uint32_t length){ /* length could be choosen longer but this is for µC */&lt;br /&gt;
  sha256_ctx_t s;&lt;br /&gt;
  sha256_init(&amp;amp;s);&lt;br /&gt;
  while(length &amp;gt;= SHA256_BLOCK_BITS){&lt;br /&gt;
    sha256_nextBlock(&amp;amp;s, msg);&lt;br /&gt;
    msg = (uint8_t*)msg + SHA256_BLOCK_BITS/8;&lt;br /&gt;
    length -= SHA256_BLOCK_BITS;&lt;br /&gt;
  }&lt;br /&gt;
  sha256_lastBlock(&amp;amp;s, msg, length);&lt;br /&gt;
  sha256_ctx2hash(dest,&amp;amp;s);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
/*************************************************************************/&lt;br /&gt;
&lt;br /&gt;
void sha256_ctx2hash(sha256_hash_t *dest, const sha256_ctx_t *state){&lt;br /&gt;
#if defined LITTLE_ENDIAN&lt;br /&gt;
  uint8_t i;&lt;br /&gt;
  for(i=0; i&amp;lt;8; ++i){&lt;br /&gt;
    ((uint32_t*)dest)[i] = change_endian32(state-&amp;gt;h[i]);&lt;br /&gt;
  }&lt;br /&gt;
#elif BIG_ENDIAN&lt;br /&gt;
  if (dest != state-&amp;gt;h)&lt;br /&gt;
    memcpy(dest, state-&amp;gt;h, SHA256_HASH_BITS/8);&lt;br /&gt;
#else&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>DooMMasteR</name></author>
		
	</entry>
</feed>