This library implements some hash and cryptographic algorithms.

Dependents:   mBuinoBlinky PB_Emma_Ethernet SLOTrashHTTP Garagem ... more

This library implements the following algorithms :

  • RC4
  • AES (AES-128, AES-192, AES-256)
  • DES
  • Triple DES (EDE)
  • MD2
  • MD4
  • MD5
  • SHA-1
  • SHA-2 (SHA-224, SHA-256, SHA-384, SHA-512)

The hash algorithms have been optimized for the mbed and you should get decent performance. However, I did not optimize the ciphers. Also, I did not test extensively these algorithms : it should work but you may find some bugs. Block ciphers support two modes : ECB and CBC.

Warning

If you are using SHA-384 or SHA-512, be aware that it produces large binary files and the compilation (using the online compiler) takes much longer to execute. It may happen that the compiler stops because it timed-out. In this case, just compile again and it should work.

Computing hash

You can compute the hash of some data in two different ways. The first one is the easiest, each hash algorithm has a static method that takes some data and compute the hash from it.

Computing hash using method 1

#include "Crypto.h"
#include "mbed.h"

static const char msg[] = "mbed is great !";

int main()
{
    uint8_t hash[16];
    MD2::computeHash(hash, (uint8_t*)msg, strlen(msg));
    printf("hash: ");
    for(int i = 0; i < 16; ++i)
        printf("%02x", hash[i]);
    printf("\n");
    
    return 0;
}

The second one is slightly slower (around 2-3% slower) but it allows you to compute the hash of some data in several steps (by calling update method). This is the method you should use if you need to compute the hash from a large source and you don't have enough memory to store it in a single buffer.

Computing hash using method 2

#include "Crypto.h"
#include "mbed.h"

static const char msg[] = "mbed is great !";

int main()
{
    uint8_t hash[16];
    MD2 h;
    h.update((uint8_t*)msg, strlen(msg));
    h.finalize(hash);
    printf("hash: ");
    for(int i = 0; i < 16; ++i)
        printf("%02x", hash[i]);
    printf("\n");
    
    return 0;
}

TODO

  • optimize ciphers
  • add doc
Committer:
feb11
Date:
Sun May 11 13:36:45 2014 +0000
Revision:
14:f04410cef037
Parent:
13:ac8e23b98dae
CBC mode completed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
feb11 0:7a1237bd2d13 1 #include "SHA2_64.h"
feb11 0:7a1237bd2d13 2 #include <string.h>
feb11 0:7a1237bd2d13 3
feb11 0:7a1237bd2d13 4
feb11 0:7a1237bd2d13 5 static const uint64_t H[] =
feb11 0:7a1237bd2d13 6 {
feb11 0:7a1237bd2d13 7 // SHA-384
feb11 0:7a1237bd2d13 8 0xcbbb9d5dc1059ed8, 0x629a292a367cd507, 0x9159015a3070dd17, 0x152fecd8f70e5939,
feb11 0:7a1237bd2d13 9 0x67332667ffc00b31, 0x8eb44a8768581511, 0xdb0c2e0d64f98fa7, 0x47b5481dbefa4fa4,
feb11 0:7a1237bd2d13 10
feb11 0:7a1237bd2d13 11 // SHA-512
feb11 0:7a1237bd2d13 12 0x6a09e667f3bcc908, 0xbb67ae8584caa73b, 0x3c6ef372fe94f82b, 0xa54ff53a5f1d36f1,
feb11 0:7a1237bd2d13 13 0x510e527fade682d1, 0x9b05688c2b3e6c1f, 0x1f83d9abfb41bd6b, 0x5be0cd19137e2179
feb11 0:7a1237bd2d13 14 };
feb11 0:7a1237bd2d13 15
feb11 0:7a1237bd2d13 16 static uint64_t revWord(uint64_t w)
feb11 0:7a1237bd2d13 17 {
feb11 13:ac8e23b98dae 18 #ifdef __CC_ARM
feb11 5:06cd9c8afa0b 19 return __rev(w >> 32)
feb11 5:06cd9c8afa0b 20 | ((uint64_t)(__rev(w)) << 32);
feb11 13:ac8e23b98dae 21 #else
feb11 13:ac8e23b98dae 22 return (w >> 56)
feb11 13:ac8e23b98dae 23 | ((w & 0x00FF000000000000) >> 40)
feb11 13:ac8e23b98dae 24 | ((w & 0x0000FF0000000000) >> 24)
feb11 13:ac8e23b98dae 25 | ((w & 0x000000FF00000000) >> 8)
feb11 13:ac8e23b98dae 26 | ((w & 0x00000000FF000000) << 8)
feb11 13:ac8e23b98dae 27 | ((w & 0x0000000000FF0000) << 24)
feb11 13:ac8e23b98dae 28 | ((w & 0x000000000000FF00) << 40)
feb11 13:ac8e23b98dae 29 | ((w & 0x00000000000000FF) << 56);
feb11 13:ac8e23b98dae 30 #endif
feb11 0:7a1237bd2d13 31 }
feb11 0:7a1237bd2d13 32
feb11 3:85c6ee25cf3e 33 #define ROTL(W,N) (((W) << (N)) | ((W) >> (64-(N))))
feb11 3:85c6ee25cf3e 34 #define ROTR(W,N) (((W) >> (N)) | ((W) << (64-(N))))
feb11 3:85c6ee25cf3e 35 #define CH(X,Y,Z) (((X) & (Y)) ^ ((~(X)) & (Z)))
feb11 3:85c6ee25cf3e 36 #define MAJ(X,Y,Z) (((X) & (Y)) ^ ((X) & (Z)) ^ ((Y) & (Z)))
feb11 3:85c6ee25cf3e 37 #define BSIG0(X) (ROTR(X,28) ^ ROTR(X,34) ^ ROTR(X,39))
feb11 3:85c6ee25cf3e 38 #define BSIG1(X) (ROTR(X,14) ^ ROTR(X,18) ^ ROTR(X,41))
feb11 3:85c6ee25cf3e 39 #define SSIG0(X) (ROTR((X),1) ^ ROTR((X),8) ^ ((X) >> 7))
feb11 3:85c6ee25cf3e 40 #define SSIG1(X) (ROTR((X),19) ^ ROTR((X),61) ^ ((X) >> 6))
feb11 0:7a1237bd2d13 41
feb11 4:0da19393bd57 42 #define R(A,B,C,D,E,F,G,H,K,T) T1 = H + BSIG1(E) + CH(E,F,G) + K + w[T]; \
feb11 4:0da19393bd57 43 T2 = BSIG0(A) + MAJ(A,B,C); \
feb11 4:0da19393bd57 44 D += T1; \
feb11 4:0da19393bd57 45 H = T1 + T2;
feb11 4:0da19393bd57 46
feb11 0:7a1237bd2d13 47
feb11 0:7a1237bd2d13 48 SHA2_64::SHA2_64(SHA2_64_TYPE t):
feb11 0:7a1237bd2d13 49 type(t),
feb11 0:7a1237bd2d13 50 totalBufferLength(0),
feb11 0:7a1237bd2d13 51 bufferLength(0)
feb11 0:7a1237bd2d13 52 {
feb11 0:7a1237bd2d13 53 switch(type)
feb11 0:7a1237bd2d13 54 {
feb11 0:7a1237bd2d13 55 case SHA_384:
feb11 0:7a1237bd2d13 56 h0 = H[0];
feb11 0:7a1237bd2d13 57 h1 = H[1];
feb11 0:7a1237bd2d13 58 h2 = H[2];
feb11 0:7a1237bd2d13 59 h3 = H[3];
feb11 0:7a1237bd2d13 60 h4 = H[4];
feb11 0:7a1237bd2d13 61 h5 = H[5];
feb11 0:7a1237bd2d13 62 h6 = H[6];
feb11 0:7a1237bd2d13 63 h7 = H[7];
feb11 0:7a1237bd2d13 64 break;
feb11 0:7a1237bd2d13 65
feb11 0:7a1237bd2d13 66 case SHA_512:
feb11 0:7a1237bd2d13 67 h0 = H[8];
feb11 0:7a1237bd2d13 68 h1 = H[9];
feb11 0:7a1237bd2d13 69 h2 = H[10];
feb11 0:7a1237bd2d13 70 h3 = H[11];
feb11 0:7a1237bd2d13 71 h4 = H[12];
feb11 0:7a1237bd2d13 72 h5 = H[13];
feb11 0:7a1237bd2d13 73 h6 = H[14];
feb11 0:7a1237bd2d13 74 h7 = H[15];
feb11 0:7a1237bd2d13 75 break;
feb11 0:7a1237bd2d13 76 }
feb11 0:7a1237bd2d13 77 }
feb11 0:7a1237bd2d13 78
feb11 6:19aa835f2bbb 79 void SHA2_64::update(uint8_t *data, uint32_t length)
feb11 0:7a1237bd2d13 80 {
feb11 13:ac8e23b98dae 81 if((int)length < 128-bufferLength)
feb11 0:7a1237bd2d13 82 {
feb11 6:19aa835f2bbb 83 memcpy(&buffer[bufferLength], data, length);
feb11 0:7a1237bd2d13 84 bufferLength += length;
feb11 0:7a1237bd2d13 85 totalBufferLength += length;
feb11 0:7a1237bd2d13 86 return;
feb11 0:7a1237bd2d13 87 }
feb11 0:7a1237bd2d13 88 int offset = 128-bufferLength;
feb11 6:19aa835f2bbb 89 memcpy(&buffer[bufferLength], data, offset);
feb11 0:7a1237bd2d13 90 computeBlock(&h0,&h1,&h2,&h3,&h4,&h5,&h6,&h7,buffer);
feb11 0:7a1237bd2d13 91 while(length-offset > 128)
feb11 0:7a1237bd2d13 92 {
feb11 6:19aa835f2bbb 93 memcpy(buffer, &data[offset], 128);
feb11 0:7a1237bd2d13 94 computeBlock(&h0,&h1,&h2,&h3,&h4,&h5,&h6,&h7,buffer);
feb11 0:7a1237bd2d13 95 offset += 128;
feb11 0:7a1237bd2d13 96 }
feb11 13:ac8e23b98dae 97 if(offset > (int)length)
feb11 0:7a1237bd2d13 98 offset -= 128;
feb11 0:7a1237bd2d13 99 bufferLength = length - offset;
feb11 6:19aa835f2bbb 100 memcpy(buffer, &data[offset], bufferLength);
feb11 0:7a1237bd2d13 101 totalBufferLength += length;
feb11 0:7a1237bd2d13 102 }
feb11 0:7a1237bd2d13 103
feb11 6:19aa835f2bbb 104 void SHA2_64::finalize(uint8_t *hash)
feb11 0:7a1237bd2d13 105 {
feb11 6:19aa835f2bbb 106 uint64_t *hash2 = (uint64_t*)hash;
feb11 5:06cd9c8afa0b 107 uint64_t lengthBit = totalBufferLength << 3;
feb11 5:06cd9c8afa0b 108 uint32_t padding;
feb11 0:7a1237bd2d13 109 if(totalBufferLength % 128 < 112)
feb11 0:7a1237bd2d13 110 padding = 112 - (totalBufferLength % 128);
feb11 0:7a1237bd2d13 111 else
feb11 0:7a1237bd2d13 112 padding = 112 + (128 - (totalBufferLength % 128));
feb11 5:06cd9c8afa0b 113
feb11 5:06cd9c8afa0b 114 buffer[bufferLength++] = 0x80;
feb11 5:06cd9c8afa0b 115 padding--;
feb11 5:06cd9c8afa0b 116 if(padding+bufferLength == 112)
feb11 5:06cd9c8afa0b 117 memset(&buffer[bufferLength], 0, padding);
feb11 5:06cd9c8afa0b 118 else
feb11 5:06cd9c8afa0b 119 {
feb11 5:06cd9c8afa0b 120 memset(&buffer[bufferLength], 0, 64-bufferLength);
feb11 5:06cd9c8afa0b 121 computeBlock(&h0, &h1, &h2, &h3, &h4, &h5, &h6, &h7, buffer);
feb11 5:06cd9c8afa0b 122 memset(buffer, 0, 112);
feb11 5:06cd9c8afa0b 123 }
feb11 5:06cd9c8afa0b 124
feb11 0:7a1237bd2d13 125 lengthBit = revWord(lengthBit);
feb11 5:06cd9c8afa0b 126 memcpy(&buffer[120], &lengthBit, 8);
feb11 5:06cd9c8afa0b 127 memset(&buffer[112], 0, 8);
feb11 5:06cd9c8afa0b 128 computeBlock(&h0, &h1, &h2, &h3, &h4, &h5, &h6, &h7, buffer);
feb11 5:06cd9c8afa0b 129
feb11 0:7a1237bd2d13 130
feb11 6:19aa835f2bbb 131 hash2[0] = revWord(h0);
feb11 6:19aa835f2bbb 132 hash2[1] = revWord(h1);
feb11 6:19aa835f2bbb 133 hash2[2] = revWord(h2);
feb11 6:19aa835f2bbb 134 hash2[3] = revWord(h3);
feb11 6:19aa835f2bbb 135 hash2[4] = revWord(h4);
feb11 6:19aa835f2bbb 136 hash2[5] = revWord(h5);
feb11 0:7a1237bd2d13 137
feb11 0:7a1237bd2d13 138
feb11 0:7a1237bd2d13 139 if(type == SHA_512)
feb11 0:7a1237bd2d13 140 {
feb11 6:19aa835f2bbb 141 hash2[6] = revWord(h6);
feb11 6:19aa835f2bbb 142 hash2[7] = revWord(h7);
feb11 0:7a1237bd2d13 143 }
feb11 0:7a1237bd2d13 144
feb11 0:7a1237bd2d13 145 // reset state
feb11 0:7a1237bd2d13 146 switch(type)
feb11 0:7a1237bd2d13 147 {
feb11 0:7a1237bd2d13 148 case SHA_384:
feb11 0:7a1237bd2d13 149 h0 = H[0];
feb11 0:7a1237bd2d13 150 h1 = H[1];
feb11 0:7a1237bd2d13 151 h2 = H[2];
feb11 0:7a1237bd2d13 152 h3 = H[3];
feb11 0:7a1237bd2d13 153 h4 = H[4];
feb11 0:7a1237bd2d13 154 h5 = H[5];
feb11 0:7a1237bd2d13 155 h6 = H[6];
feb11 0:7a1237bd2d13 156 h7 = H[7];
feb11 0:7a1237bd2d13 157 break;
feb11 0:7a1237bd2d13 158
feb11 0:7a1237bd2d13 159 case SHA_512:
feb11 0:7a1237bd2d13 160 h0 = H[8];
feb11 0:7a1237bd2d13 161 h1 = H[9];
feb11 0:7a1237bd2d13 162 h2 = H[10];
feb11 0:7a1237bd2d13 163 h3 = H[11];
feb11 0:7a1237bd2d13 164 h4 = H[12];
feb11 0:7a1237bd2d13 165 h5 = H[13];
feb11 0:7a1237bd2d13 166 h6 = H[14];
feb11 0:7a1237bd2d13 167 h7 = H[15];
feb11 0:7a1237bd2d13 168 break;
feb11 0:7a1237bd2d13 169 }
feb11 0:7a1237bd2d13 170 totalBufferLength = 0;
feb11 0:7a1237bd2d13 171 bufferLength = 0;
feb11 0:7a1237bd2d13 172 }
feb11 0:7a1237bd2d13 173
feb11 6:19aa835f2bbb 174 void SHA2_64::computeHash(SHA2_64_TYPE type, uint8_t *hash, uint8_t *data, uint32_t length)
feb11 6:19aa835f2bbb 175 {
feb11 6:19aa835f2bbb 176 uint64_t *hash2 = (uint64_t*)hash;
feb11 6:19aa835f2bbb 177 uint64_t lengthBit = length * 8;
feb11 6:19aa835f2bbb 178 uint64_t h0 = H[type*8], h1 = H[type*8+1], h2 = H[type*8+2], h3 = H[type*8+3];
feb11 6:19aa835f2bbb 179 uint64_t h4 = H[type*8+4], h5 = H[type*8+5], h6 = H[type*8+6], h7 = H[type*8+7];
feb11 6:19aa835f2bbb 180
feb11 6:19aa835f2bbb 181 int padding;
feb11 6:19aa835f2bbb 182 if(length % 128 < 112)
feb11 6:19aa835f2bbb 183 padding = 112 - (length % 128);
feb11 6:19aa835f2bbb 184 else
feb11 6:19aa835f2bbb 185 padding = 112 + (128 - (length % 128));
feb11 6:19aa835f2bbb 186
feb11 6:19aa835f2bbb 187 while(length >= 128)
feb11 6:19aa835f2bbb 188 {
feb11 6:19aa835f2bbb 189 computeBlock(&h0, &h1, &h2, &h3, &h4, &h5, &h6, &h7, data);
feb11 6:19aa835f2bbb 190 data += 128;
feb11 6:19aa835f2bbb 191 length -= 128;
feb11 6:19aa835f2bbb 192 }
feb11 6:19aa835f2bbb 193 uint8_t buffer[128];
feb11 6:19aa835f2bbb 194 memcpy(buffer, data,length);
feb11 6:19aa835f2bbb 195 buffer[length] = 0x80;
feb11 6:19aa835f2bbb 196 length++;
feb11 6:19aa835f2bbb 197 padding--;
feb11 6:19aa835f2bbb 198
feb11 6:19aa835f2bbb 199 if(padding+length == 112)
feb11 6:19aa835f2bbb 200 memset(&buffer[length], 0, padding);
feb11 6:19aa835f2bbb 201 else
feb11 6:19aa835f2bbb 202 {
feb11 6:19aa835f2bbb 203 memset(&buffer[length], 0, 128-length);
feb11 6:19aa835f2bbb 204 computeBlock(&h0, &h1, &h2, &h3, &h4, &h5, &h6, &h7, buffer);
feb11 6:19aa835f2bbb 205 memset(buffer, 0, 112);
feb11 6:19aa835f2bbb 206 }
feb11 6:19aa835f2bbb 207
feb11 6:19aa835f2bbb 208 lengthBit = revWord(lengthBit);
feb11 6:19aa835f2bbb 209 memset(&buffer[112], 0, 8);
feb11 6:19aa835f2bbb 210 memcpy(&buffer[120], &lengthBit, 8);
feb11 6:19aa835f2bbb 211 computeBlock(&h0, &h1, &h2, &h3, &h4, &h5, &h6, &h7, buffer);
feb11 6:19aa835f2bbb 212
feb11 6:19aa835f2bbb 213 hash2[0] = revWord(h0);
feb11 6:19aa835f2bbb 214 hash2[1] = revWord(h1);
feb11 6:19aa835f2bbb 215 hash2[2] = revWord(h2);
feb11 6:19aa835f2bbb 216 hash2[3] = revWord(h3);
feb11 6:19aa835f2bbb 217 hash2[4] = revWord(h4);
feb11 6:19aa835f2bbb 218 hash2[5] = revWord(h5);
feb11 6:19aa835f2bbb 219
feb11 6:19aa835f2bbb 220
feb11 6:19aa835f2bbb 221 if(type == SHA_512)
feb11 6:19aa835f2bbb 222 {
feb11 6:19aa835f2bbb 223 hash2[6] = revWord(h6);
feb11 6:19aa835f2bbb 224 hash2[7] = revWord(h7);
feb11 6:19aa835f2bbb 225 }
feb11 6:19aa835f2bbb 226 }
feb11 6:19aa835f2bbb 227
feb11 0:7a1237bd2d13 228 void SHA2_64::computeBlock(uint64_t *h02,
feb11 0:7a1237bd2d13 229 uint64_t *h12,
feb11 0:7a1237bd2d13 230 uint64_t *h22,
feb11 0:7a1237bd2d13 231 uint64_t *h32,
feb11 0:7a1237bd2d13 232 uint64_t *h42,
feb11 0:7a1237bd2d13 233 uint64_t *h52,
feb11 0:7a1237bd2d13 234 uint64_t *h62,
feb11 0:7a1237bd2d13 235 uint64_t *h72,
feb11 0:7a1237bd2d13 236 uint8_t *buffer)
feb11 0:7a1237bd2d13 237 {
feb11 0:7a1237bd2d13 238 uint64_t w[80];
feb11 4:0da19393bd57 239 uint64_t *buffer2 = (uint64_t*)buffer;
feb11 4:0da19393bd57 240
feb11 4:0da19393bd57 241 w[0] = revWord(buffer2[0]);
feb11 4:0da19393bd57 242 w[1] = revWord(buffer2[1]);
feb11 4:0da19393bd57 243 w[2] = revWord(buffer2[2]);
feb11 4:0da19393bd57 244 w[3] = revWord(buffer2[3]);
feb11 4:0da19393bd57 245 w[4] = revWord(buffer2[4]);
feb11 4:0da19393bd57 246 w[5] = revWord(buffer2[5]);
feb11 4:0da19393bd57 247 w[6] = revWord(buffer2[6]);
feb11 4:0da19393bd57 248 w[7] = revWord(buffer2[7]);
feb11 4:0da19393bd57 249 w[8] = revWord(buffer2[8]);
feb11 4:0da19393bd57 250 w[9] = revWord(buffer2[9]);
feb11 4:0da19393bd57 251 w[10] = revWord(buffer2[10]);
feb11 4:0da19393bd57 252 w[11] = revWord(buffer2[11]);
feb11 4:0da19393bd57 253 w[12] = revWord(buffer2[12]);
feb11 4:0da19393bd57 254 w[13] = revWord(buffer2[13]);
feb11 4:0da19393bd57 255 w[14] = revWord(buffer2[14]);
feb11 4:0da19393bd57 256 w[15] = revWord(buffer2[15]);
feb11 4:0da19393bd57 257
feb11 0:7a1237bd2d13 258 for(int t = 16; t < 80; ++t)
feb11 0:7a1237bd2d13 259 w[t] = SSIG1(w[t-2]) + w[t-7] + SSIG0(w[t-15]) + w[t-16];
feb11 0:7a1237bd2d13 260
feb11 0:7a1237bd2d13 261 uint64_t a = *h02, b = *h12, c = *h22, d = *h32, e = *h42, f = *h52, g = *h62, h = *h72;
feb11 4:0da19393bd57 262 uint64_t T1, T2;
feb11 4:0da19393bd57 263
feb11 4:0da19393bd57 264
feb11 4:0da19393bd57 265 R(a,b,c,d,e,f,g,h,0x428a2f98d728ae22,0)
feb11 4:0da19393bd57 266 R(h,a,b,c,d,e,f,g,0x7137449123ef65cd,1)
feb11 4:0da19393bd57 267 R(g,h,a,b,c,d,e,f,0xb5c0fbcfec4d3b2f,2)
feb11 4:0da19393bd57 268 R(f,g,h,a,b,c,d,e,0xe9b5dba58189dbbc,3)
feb11 4:0da19393bd57 269 R(e,f,g,h,a,b,c,d,0x3956c25bf348b538,4)
feb11 4:0da19393bd57 270 R(d,e,f,g,h,a,b,c,0x59f111f1b605d019,5)
feb11 4:0da19393bd57 271 R(c,d,e,f,g,h,a,b,0x923f82a4af194f9b,6)
feb11 4:0da19393bd57 272 R(b,c,d,e,f,g,h,a,0xab1c5ed5da6d8118,7)
feb11 4:0da19393bd57 273
feb11 4:0da19393bd57 274 R(a,b,c,d,e,f,g,h,0xd807aa98a3030242,8)
feb11 4:0da19393bd57 275 R(h,a,b,c,d,e,f,g,0x12835b0145706fbe,9)
feb11 4:0da19393bd57 276 R(g,h,a,b,c,d,e,f,0x243185be4ee4b28c,10)
feb11 4:0da19393bd57 277 R(f,g,h,a,b,c,d,e,0x550c7dc3d5ffb4e2,11)
feb11 4:0da19393bd57 278 R(e,f,g,h,a,b,c,d,0x72be5d74f27b896f,12)
feb11 4:0da19393bd57 279 R(d,e,f,g,h,a,b,c,0x80deb1fe3b1696b1,13)
feb11 4:0da19393bd57 280 R(c,d,e,f,g,h,a,b,0x9bdc06a725c71235,14)
feb11 4:0da19393bd57 281 R(b,c,d,e,f,g,h,a,0xc19bf174cf692694,15)
feb11 4:0da19393bd57 282
feb11 4:0da19393bd57 283
feb11 4:0da19393bd57 284 R(a,b,c,d,e,f,g,h,0xe49b69c19ef14ad2,16)
feb11 4:0da19393bd57 285 R(h,a,b,c,d,e,f,g,0xefbe4786384f25e3,17)
feb11 4:0da19393bd57 286 R(g,h,a,b,c,d,e,f,0x0fc19dc68b8cd5b5,18)
feb11 4:0da19393bd57 287 R(f,g,h,a,b,c,d,e,0x240ca1cc77ac9c65,19)
feb11 4:0da19393bd57 288 R(e,f,g,h,a,b,c,d,0x2de92c6f592b0275,20)
feb11 4:0da19393bd57 289 R(d,e,f,g,h,a,b,c,0x4a7484aa6ea6e483,21)
feb11 4:0da19393bd57 290 R(c,d,e,f,g,h,a,b,0x5cb0a9dcbd41fbd4,22)
feb11 4:0da19393bd57 291 R(b,c,d,e,f,g,h,a,0x76f988da831153b5,23)
feb11 4:0da19393bd57 292
feb11 4:0da19393bd57 293 R(a,b,c,d,e,f,g,h,0x983e5152ee66dfab,24)
feb11 4:0da19393bd57 294 R(h,a,b,c,d,e,f,g,0xa831c66d2db43210,25)
feb11 4:0da19393bd57 295 R(g,h,a,b,c,d,e,f,0xb00327c898fb213f,26)
feb11 4:0da19393bd57 296 R(f,g,h,a,b,c,d,e,0xbf597fc7beef0ee4,27)
feb11 4:0da19393bd57 297 R(e,f,g,h,a,b,c,d,0xc6e00bf33da88fc2,28)
feb11 4:0da19393bd57 298 R(d,e,f,g,h,a,b,c,0xd5a79147930aa725,29)
feb11 4:0da19393bd57 299 R(c,d,e,f,g,h,a,b,0x06ca6351e003826f,30)
feb11 4:0da19393bd57 300 R(b,c,d,e,f,g,h,a,0x142929670a0e6e70,31)
feb11 4:0da19393bd57 301
feb11 4:0da19393bd57 302
feb11 4:0da19393bd57 303 R(a,b,c,d,e,f,g,h,0x27b70a8546d22ffc,32)
feb11 4:0da19393bd57 304 R(h,a,b,c,d,e,f,g,0x2e1b21385c26c926,33)
feb11 4:0da19393bd57 305 R(g,h,a,b,c,d,e,f,0x4d2c6dfc5ac42aed,34)
feb11 4:0da19393bd57 306 R(f,g,h,a,b,c,d,e,0x53380d139d95b3df,35)
feb11 4:0da19393bd57 307 R(e,f,g,h,a,b,c,d,0x650a73548baf63de,36)
feb11 4:0da19393bd57 308 R(d,e,f,g,h,a,b,c,0x766a0abb3c77b2a8,37)
feb11 4:0da19393bd57 309 R(c,d,e,f,g,h,a,b,0x81c2c92e47edaee6,38)
feb11 4:0da19393bd57 310 R(b,c,d,e,f,g,h,a,0x92722c851482353b,39)
feb11 4:0da19393bd57 311
feb11 4:0da19393bd57 312 R(a,b,c,d,e,f,g,h,0xa2bfe8a14cf10364,40)
feb11 4:0da19393bd57 313 R(h,a,b,c,d,e,f,g,0xa81a664bbc423001,41)
feb11 4:0da19393bd57 314 R(g,h,a,b,c,d,e,f,0xc24b8b70d0f89791,42)
feb11 4:0da19393bd57 315 R(f,g,h,a,b,c,d,e,0xc76c51a30654be30,43)
feb11 4:0da19393bd57 316 R(e,f,g,h,a,b,c,d,0xd192e819d6ef5218,44)
feb11 4:0da19393bd57 317 R(d,e,f,g,h,a,b,c,0xd69906245565a910,45)
feb11 4:0da19393bd57 318 R(c,d,e,f,g,h,a,b,0xf40e35855771202a,46)
feb11 4:0da19393bd57 319 R(b,c,d,e,f,g,h,a,0x106aa07032bbd1b8,47)
feb11 4:0da19393bd57 320
feb11 4:0da19393bd57 321 R(a,b,c,d,e,f,g,h,0x19a4c116b8d2d0c8,48)
feb11 4:0da19393bd57 322 R(h,a,b,c,d,e,f,g,0x1e376c085141ab53,49)
feb11 4:0da19393bd57 323 R(g,h,a,b,c,d,e,f,0x2748774cdf8eeb99,50)
feb11 4:0da19393bd57 324 R(f,g,h,a,b,c,d,e,0x34b0bcb5e19b48a8,51)
feb11 4:0da19393bd57 325 R(e,f,g,h,a,b,c,d,0x391c0cb3c5c95a63,52)
feb11 4:0da19393bd57 326 R(d,e,f,g,h,a,b,c,0x4ed8aa4ae3418acb,53)
feb11 4:0da19393bd57 327 R(c,d,e,f,g,h,a,b,0x5b9cca4f7763e373,54)
feb11 4:0da19393bd57 328 R(b,c,d,e,f,g,h,a,0x682e6ff3d6b2b8a3,55)
feb11 4:0da19393bd57 329
feb11 4:0da19393bd57 330 R(a,b,c,d,e,f,g,h,0x748f82ee5defb2fc,56)
feb11 4:0da19393bd57 331 R(h,a,b,c,d,e,f,g,0x78a5636f43172f60,57)
feb11 4:0da19393bd57 332 R(g,h,a,b,c,d,e,f,0x84c87814a1f0ab72,58)
feb11 4:0da19393bd57 333 R(f,g,h,a,b,c,d,e,0x8cc702081a6439ec,59)
feb11 4:0da19393bd57 334 R(e,f,g,h,a,b,c,d,0x90befffa23631e28,60)
feb11 4:0da19393bd57 335 R(d,e,f,g,h,a,b,c,0xa4506cebde82bde9,61)
feb11 4:0da19393bd57 336 R(c,d,e,f,g,h,a,b,0xbef9a3f7b2c67915,62)
feb11 4:0da19393bd57 337 R(b,c,d,e,f,g,h,a,0xc67178f2e372532b,63)
feb11 4:0da19393bd57 338
feb11 4:0da19393bd57 339 R(a,b,c,d,e,f,g,h,0xca273eceea26619c,64)
feb11 4:0da19393bd57 340 R(h,a,b,c,d,e,f,g,0xd186b8c721c0c207,65)
feb11 4:0da19393bd57 341 R(g,h,a,b,c,d,e,f,0xeada7dd6cde0eb1e,66)
feb11 4:0da19393bd57 342 R(f,g,h,a,b,c,d,e,0xf57d4f7fee6ed178,67)
feb11 4:0da19393bd57 343 R(e,f,g,h,a,b,c,d,0x06f067aa72176fba,68)
feb11 4:0da19393bd57 344 R(d,e,f,g,h,a,b,c,0x0a637dc5a2c898a6,69)
feb11 4:0da19393bd57 345 R(c,d,e,f,g,h,a,b,0x113f9804bef90dae,70)
feb11 4:0da19393bd57 346 R(b,c,d,e,f,g,h,a,0x1b710b35131c471b,71)
feb11 4:0da19393bd57 347
feb11 4:0da19393bd57 348 R(a,b,c,d,e,f,g,h,0x28db77f523047d84,72)
feb11 4:0da19393bd57 349 R(h,a,b,c,d,e,f,g,0x32caab7b40c72493,73)
feb11 4:0da19393bd57 350 R(g,h,a,b,c,d,e,f,0x3c9ebe0a15c9bebc,74)
feb11 4:0da19393bd57 351 R(f,g,h,a,b,c,d,e,0x431d67c49c100d4c,75)
feb11 4:0da19393bd57 352 R(e,f,g,h,a,b,c,d,0x4cc5d4becb3e42b6,76)
feb11 4:0da19393bd57 353 R(d,e,f,g,h,a,b,c,0x597f299cfc657e2a,77)
feb11 4:0da19393bd57 354 R(c,d,e,f,g,h,a,b,0x5fcb6fab3ad6faec,78)
feb11 4:0da19393bd57 355 R(b,c,d,e,f,g,h,a,0x6c44198c4a475817,79)
feb11 4:0da19393bd57 356
feb11 0:7a1237bd2d13 357 *h02 += a;
feb11 0:7a1237bd2d13 358 *h12 += b;
feb11 0:7a1237bd2d13 359 *h22 += c;
feb11 0:7a1237bd2d13 360 *h32 += d;
feb11 0:7a1237bd2d13 361 *h42 += e;
feb11 0:7a1237bd2d13 362 *h52 += f;
feb11 0:7a1237bd2d13 363 *h62 += g;
feb11 0:7a1237bd2d13 364 *h72 += h;
feb11 13:ac8e23b98dae 365 }