#define CUBEHASH_ROUNDS 16 #include "crypto_hash.h" #include "crypto_uint8.h" #include "crypto_uint16.h" #include "crypto_uint32.h" typedef crypto_uint8 crypto_uint1; typedef crypto_uint8 crypto_uint2; typedef crypto_uint8 crypto_uint3; typedef crypto_uint16 crypto_uint11; int crypto_hash(unsigned char *out,const unsigned char *in,unsigned long long inlen) { crypto_uint2 newx00; crypto_uint2 x00[16] = {(512 / 8) % 4,(512 / 32) % 4,(512 / 128) % 4,(512 / 512) % 4}; crypto_uint2 newx01; crypto_uint2 x01[16] = {32 % 4,(32 / 4) % 4,(32 / 16) % 4,(32 / 64) % 4}; crypto_uint2 newx02; crypto_uint2 x02[16] = {CUBEHASH_ROUNDS % 4,(CUBEHASH_ROUNDS / 4) % 4,(CUBEHASH_ROUNDS / 16) % 4,(CUBEHASH_ROUNDS / 64) % 4}; crypto_uint2 newx03; crypto_uint2 x03[16] = {0}; crypto_uint2 newx04; crypto_uint2 x04[16] = {0}; crypto_uint2 newx05; crypto_uint2 x05[16] = {0}; crypto_uint2 newx06; crypto_uint2 x06[16] = {0}; crypto_uint2 newx07; crypto_uint2 x07[16] = {0}; crypto_uint2 newx08; crypto_uint2 x08[16] = {0}; crypto_uint2 newx09; crypto_uint2 x09[16] = {0}; crypto_uint2 newx0a; crypto_uint2 x0a[16] = {0}; crypto_uint2 newx0b; crypto_uint2 x0b[16] = {0}; crypto_uint2 newx0c; crypto_uint2 x0c[16] = {0}; crypto_uint2 newx0d; crypto_uint2 x0d[16] = {0}; crypto_uint2 newx0e; crypto_uint2 x0e[16] = {0}; crypto_uint2 newx0f; crypto_uint2 x0f[16] = {0}; crypto_uint2 newx10; crypto_uint2 x10[16] = {0}; crypto_uint2 newx11; crypto_uint2 x11[16] = {0}; crypto_uint2 newx12; crypto_uint2 x12[16] = {0}; crypto_uint2 newx13; crypto_uint2 x13[16] = {0}; crypto_uint2 newx14; crypto_uint2 x14[16] = {0}; crypto_uint2 newx15; crypto_uint2 x15[16] = {0}; crypto_uint2 newx16; crypto_uint2 x16[16] = {0}; crypto_uint2 newx17; crypto_uint2 x17[16] = {0}; crypto_uint2 newx18; crypto_uint2 x18[16] = {0}; crypto_uint2 newx19; crypto_uint2 x19[16] = {0}; crypto_uint2 newx1a; crypto_uint2 x1a[16] = {0}; crypto_uint2 newx1b; crypto_uint2 x1b[16] = {0}; crypto_uint2 newx1c; crypto_uint2 x1c[16] = {0}; crypto_uint2 newx1d; crypto_uint2 x1d[16] = {0}; crypto_uint2 newx1e; crypto_uint2 x1e[16] = {0}; crypto_uint2 newx1f; crypto_uint2 x1f[16] = {0}; crypto_uint11 newq0; crypto_uint11 q0; crypto_uint11 newq1; crypto_uint11 q1; crypto_uint11 newq2; crypto_uint11 q2; crypto_uint11 newq3; crypto_uint11 q3; crypto_uint11 newq4; crypto_uint11 q4; crypto_uint11 newq5; crypto_uint11 q5; crypto_uint11 newq6; crypto_uint11 q6; crypto_uint11 newq7; crypto_uint11 q7; crypto_uint11 newq8; crypto_uint11 q8; crypto_uint11 newq9; crypto_uint11 q9; crypto_uint11 newqa; crypto_uint11 qa; crypto_uint11 newqb; crypto_uint11 qb; crypto_uint11 newqc; crypto_uint11 qc; crypto_uint11 newqd; crypto_uint11 qd; crypto_uint11 newqe; crypto_uint11 qe; crypto_uint11 newqf; crypto_uint11 qf; crypto_uint1 keep; crypto_uint1 qshift; crypto_uint1 qshift2; crypto_uint1 newcarry0; crypto_uint1 carry0 = 0; crypto_uint1 newcarry1; crypto_uint1 carry1 = 0; crypto_uint1 newcarry2; crypto_uint1 carry2 = 0; crypto_uint1 newcarry3; crypto_uint1 carry3 = 0; crypto_uint1 newcarry4; crypto_uint1 carry4 = 0; crypto_uint1 newcarry5; crypto_uint1 carry5 = 0; crypto_uint1 newcarry6; crypto_uint1 carry6 = 0; crypto_uint1 newcarry7; crypto_uint1 carry7 = 0; crypto_uint1 newcarry8; crypto_uint1 carry8 = 0; crypto_uint1 newcarry9; crypto_uint1 carry9 = 0; crypto_uint1 newcarrya; crypto_uint1 carrya = 0; crypto_uint1 newcarryb; crypto_uint1 carryb = 0; crypto_uint1 newcarryc; crypto_uint1 carryc = 0; crypto_uint1 newcarryd; crypto_uint1 carryd = 0; crypto_uint1 newcarrye; crypto_uint1 carrye = 0; crypto_uint1 newcarryf; crypto_uint1 carryf = 0; crypto_uint2 z0; crypto_uint2 z1; crypto_uint2 z2; crypto_uint2 z3; crypto_uint2 z4; crypto_uint2 z5; crypto_uint2 z6; crypto_uint2 z7; crypto_uint2 z8; crypto_uint2 z9; crypto_uint2 za; crypto_uint2 zb; crypto_uint2 zc; crypto_uint2 zd; crypto_uint2 ze; crypto_uint2 zf; crypto_uint3 sum0; crypto_uint3 sum1; crypto_uint3 sum2; crypto_uint3 sum3; crypto_uint3 sum4; crypto_uint3 sum5; crypto_uint3 sum6; crypto_uint3 sum7; crypto_uint3 sum8; crypto_uint3 sum9; crypto_uint3 suma; crypto_uint3 sumb; crypto_uint3 sumc; crypto_uint3 sumd; crypto_uint3 sume; crypto_uint3 sumf; crypto_uint1 bit0; crypto_uint1 bit1; crypto_uint1 bit2; crypto_uint1 bit3; crypto_uint1 bit4; crypto_uint1 bit5; crypto_uint1 bit6; crypto_uint1 bit7; crypto_uint1 bit8; crypto_uint1 bit9; crypto_uint1 bita; crypto_uint1 bitb; crypto_uint1 bitc; crypto_uint1 bitd; crypto_uint1 bite; crypto_uint1 bitf; crypto_uint1 bip0; crypto_uint1 bip1; crypto_uint1 bip2; crypto_uint1 bip3; crypto_uint1 bip4; crypto_uint1 bip5; crypto_uint1 bip6; crypto_uint1 bip7; crypto_uint1 bip8; crypto_uint1 bip9; crypto_uint1 bipa; crypto_uint1 bipb; crypto_uint1 bipc; crypto_uint1 bipd; crypto_uint1 bipe; crypto_uint1 bipf; crypto_uint2 top0; crypto_uint2 top1; crypto_uint2 top2; crypto_uint2 top3; crypto_uint2 top4; crypto_uint2 top5; crypto_uint2 top6; crypto_uint2 top7; crypto_uint2 top8; crypto_uint2 top9; crypto_uint2 topa; crypto_uint2 topb; crypto_uint2 topc; crypto_uint2 topd; crypto_uint2 tope; crypto_uint2 topf; crypto_uint2 s0; crypto_uint2 t0; crypto_uint2 s1; crypto_uint2 t1; crypto_uint2 s2; crypto_uint2 t2; crypto_uint2 s3; crypto_uint2 t3; crypto_uint2 s4; crypto_uint2 t4; crypto_uint2 s5; crypto_uint2 t5; crypto_uint2 s6; crypto_uint2 t6; crypto_uint2 s7; crypto_uint2 t7; crypto_uint2 s8; crypto_uint2 t8; crypto_uint2 s9; crypto_uint2 t9; crypto_uint2 sa; crypto_uint2 ta; crypto_uint2 sb; crypto_uint2 tb; crypto_uint2 sc; crypto_uint2 tc; crypto_uint2 sd; crypto_uint2 td; crypto_uint2 se; crypto_uint2 te; crypto_uint2 sf; crypto_uint2 tf; int i; int r; int cycle; int bigcycle; int finalization = 0; unsigned char tmp[32]; r = 16; goto morerounds; if (inlen < 32) goto inlenbelow32; mainloop: for (i = 0;i < 4;++i) { x00[4*i] ^= (in[i] & 3); x01[4*i] ^= (in[i + 4] & 3); x02[4*i] ^= (in[i + 8] & 3); x03[4*i] ^= (in[i + 12] & 3); x04[4*i] ^= (in[i + 16] & 3); x05[4*i] ^= (in[i + 20] & 3); x06[4*i] ^= (in[i + 24] & 3); x07[4*i] ^= (in[i + 28] & 3); x00[4*i+1] ^= ((in[i] >> 2) & 3); x01[4*i+1] ^= ((in[i + 4] >> 2) & 3); x02[4*i+1] ^= ((in[i + 8] >> 2) & 3); x03[4*i+1] ^= ((in[i + 12] >> 2) & 3); x04[4*i+1] ^= ((in[i + 16] >> 2) & 3); x05[4*i+1] ^= ((in[i + 20] >> 2) & 3); x06[4*i+1] ^= ((in[i + 24] >> 2) & 3); x07[4*i+1] ^= ((in[i + 28] >> 2) & 3); x00[4*i+2] ^= ((in[i] >> 4) & 3); x01[4*i+2] ^= ((in[i + 4] >> 4) & 3); x02[4*i+2] ^= ((in[i + 8] >> 4) & 3); x03[4*i+2] ^= ((in[i + 12] >> 4) & 3); x04[4*i+2] ^= ((in[i + 16] >> 4) & 3); x05[4*i+2] ^= ((in[i + 20] >> 4) & 3); x06[4*i+2] ^= ((in[i + 24] >> 4) & 3); x07[4*i+2] ^= ((in[i + 28] >> 4) & 3); x00[4*i+3] ^= ((in[i] >> 6) & 3); x01[4*i+3] ^= ((in[i + 4] >> 6) & 3); x02[4*i+3] ^= ((in[i + 8] >> 6) & 3); x03[4*i+3] ^= ((in[i + 12] >> 6) & 3); x04[4*i+3] ^= ((in[i + 16] >> 6) & 3); x05[4*i+3] ^= ((in[i + 20] >> 6) & 3); x06[4*i+3] ^= ((in[i + 24] >> 6) & 3); x07[4*i+3] ^= ((in[i + 28] >> 6) & 3); } in += 32; inlen -= 32; r = CUBEHASH_ROUNDS; morerounds: q0 = (x08[12]>>1)|((crypto_uint11)x08[13]<<1)|((crypto_uint11)x08[14]<<3)|((crypto_uint11)x08[15]<<5); q1 = (x09[12]>>1)|((crypto_uint11)x09[13]<<1)|((crypto_uint11)x09[14]<<3)|((crypto_uint11)x09[15]<<5); q2 = (x0a[12]>>1)|((crypto_uint11)x0a[13]<<1)|((crypto_uint11)x0a[14]<<3)|((crypto_uint11)x0a[15]<<5); q3 = (x0b[12]>>1)|((crypto_uint11)x0b[13]<<1)|((crypto_uint11)x0b[14]<<3)|((crypto_uint11)x0b[15]<<5); q4 = (x0c[12]>>1)|((crypto_uint11)x0c[13]<<1)|((crypto_uint11)x0c[14]<<3)|((crypto_uint11)x0c[15]<<5); q5 = (x0d[12]>>1)|((crypto_uint11)x0d[13]<<1)|((crypto_uint11)x0d[14]<<3)|((crypto_uint11)x0d[15]<<5); q6 = (x0e[12]>>1)|((crypto_uint11)x0e[13]<<1)|((crypto_uint11)x0e[14]<<3)|((crypto_uint11)x0e[15]<<5); q7 = (x0f[12]>>1)|((crypto_uint11)x0f[13]<<1)|((crypto_uint11)x0f[14]<<3)|((crypto_uint11)x0f[15]<<5); q8 = (x00[12]>>1)|((crypto_uint11)x00[13]<<1)|((crypto_uint11)x00[14]<<3)|((crypto_uint11)x00[15]<<5); q9 = (x01[12]>>1)|((crypto_uint11)x01[13]<<1)|((crypto_uint11)x01[14]<<3)|((crypto_uint11)x01[15]<<5); qa = (x02[12]>>1)|((crypto_uint11)x02[13]<<1)|((crypto_uint11)x02[14]<<3)|((crypto_uint11)x02[15]<<5); qb = (x03[12]>>1)|((crypto_uint11)x03[13]<<1)|((crypto_uint11)x03[14]<<3)|((crypto_uint11)x03[15]<<5); qc = (x04[12]>>1)|((crypto_uint11)x04[13]<<1)|((crypto_uint11)x04[14]<<3)|((crypto_uint11)x04[15]<<5); qd = (x05[12]>>1)|((crypto_uint11)x05[13]<<1)|((crypto_uint11)x05[14]<<3)|((crypto_uint11)x05[15]<<5); qe = (x06[12]>>1)|((crypto_uint11)x06[13]<<1)|((crypto_uint11)x06[14]<<3)|((crypto_uint11)x06[15]<<5); qf = (x07[12]>>1)|((crypto_uint11)x07[13]<<1)|((crypto_uint11)x07[14]<<3)|((crypto_uint11)x07[15]<<5); for (;r > 0;--r) { for (bigcycle = 0;bigcycle < 2;++bigcycle) { for (cycle = 0;cycle < 16;++cycle) { z0 = x00[cycle]; z1 = x01[cycle]; z2 = x02[cycle]; z3 = x03[cycle]; z4 = x04[cycle]; z5 = x05[cycle]; z6 = x06[cycle]; z7 = x07[cycle]; z8 = x08[cycle]; z9 = x09[cycle]; za = x0a[cycle]; zb = x0b[cycle]; zc = x0c[cycle]; zd = x0d[cycle]; ze = x0e[cycle]; zf = x0f[cycle]; sum0 = x10[cycle] + (crypto_uint3) z0 + carry0; sum1 = x11[cycle] + (crypto_uint3) z1 + carry1; sum2 = x12[cycle] + (crypto_uint3) z2 + carry2; sum3 = x13[cycle] + (crypto_uint3) z3 + carry3; sum4 = x14[cycle] + (crypto_uint3) z4 + carry4; sum5 = x15[cycle] + (crypto_uint3) z5 + carry5; sum6 = x16[cycle] + (crypto_uint3) z6 + carry6; sum7 = x17[cycle] + (crypto_uint3) z7 + carry7; sum8 = x18[cycle] + (crypto_uint3) z8 + carry8; sum9 = x19[cycle] + (crypto_uint3) z9 + carry9; suma = x1a[cycle] + (crypto_uint3) za + carrya; sumb = x1b[cycle] + (crypto_uint3) zb + carryb; sumc = x1c[cycle] + (crypto_uint3) zc + carryc; sumd = x1d[cycle] + (crypto_uint3) zd + carryd; sume = x1e[cycle] + (crypto_uint3) ze + carrye; sumf = x1f[cycle] + (crypto_uint3) zf + carryf; s0 = sum0 & 3; s1 = sum1 & 3; s2 = sum2 & 3; s3 = sum3 & 3; s4 = sum4 & 3; s5 = sum5 & 3; s6 = sum6 & 3; s7 = sum7 & 3; s8 = sum8 & 3; s9 = sum9 & 3; sa = suma & 3; sb = sumb & 3; sc = sumc & 3; sd = sumd & 3; se = sume & 3; sf = sumf & 3; keep = cycle < 15; newcarry0 = keep & (sum0 >> 2); newcarry1 = keep & (sum1 >> 2); newcarry2 = keep & (sum2 >> 2); newcarry3 = keep & (sum3 >> 2); newcarry4 = keep & (sum4 >> 2); newcarry5 = keep & (sum5 >> 2); newcarry6 = keep & (sum6 >> 2); newcarry7 = keep & (sum7 >> 2); newcarry8 = keep & (sum8 >> 2); newcarry9 = keep & (sum9 >> 2); newcarrya = keep & (suma >> 2); newcarryb = keep & (sumb >> 2); newcarryc = keep & (sumc >> 2); newcarryd = keep & (sumd >> 2); newcarrye = keep & (sume >> 2); newcarryf = keep & (sumf >> 2); t0 = q0 & 3; t1 = q1 & 3; t2 = q2 & 3; t3 = q3 & 3; t4 = q4 & 3; t5 = q5 & 3; t6 = q6 & 3; t7 = q7 & 3; t8 = q8 & 3; t9 = q9 & 3; ta = qa & 3; tb = qb & 3; tc = qc & 3; td = qd & 3; te = qe & 3; tf = qf & 3; newx00 = s0 ^ t0; newx01 = s1 ^ t1; newx02 = s2 ^ t2; newx03 = s3 ^ t3; newx04 = s4 ^ t4; newx05 = s5 ^ t5; newx06 = s6 ^ t6; newx07 = s7 ^ t7; newx08 = s8 ^ t8; newx09 = s9 ^ t9; newx0a = sa ^ ta; newx0b = sb ^ tb; newx0c = sc ^ tc; newx0d = sd ^ td; newx0e = se ^ te; newx0f = sf ^ tf; newx10 = bigcycle ? s1 : s2; newx11 = bigcycle ? s0 : s3; newx12 = bigcycle ? s3 : s0; newx13 = bigcycle ? s2 : s1; newx14 = bigcycle ? s5 : s6; newx15 = bigcycle ? s4 : s7; newx16 = bigcycle ? s7 : s4; newx17 = bigcycle ? s6 : s5; newx18 = bigcycle ? s9 : sa; newx19 = bigcycle ? s8 : sb; newx1a = bigcycle ? sb : s8; newx1b = bigcycle ? sa : s9; newx1c = bigcycle ? sd : se; newx1d = bigcycle ? sc : sf; newx1e = bigcycle ? sf : sc; newx1f = bigcycle ? se : sd; qshift = !bigcycle ^ (cycle < 13); bit0 = qshift ? ((q0 & 128) >> 7) : (bigcycle ? (newx08 & 1) : (z8 & 1)); bit1 = qshift ? ((q1 & 128) >> 7) : (bigcycle ? (newx09 & 1) : (z9 & 1)); bit2 = qshift ? ((q2 & 128) >> 7) : (bigcycle ? (newx0a & 1) : (za & 1)); bit3 = qshift ? ((q3 & 128) >> 7) : (bigcycle ? (newx0b & 1) : (zb & 1)); bit4 = qshift ? ((q4 & 128) >> 7) : (bigcycle ? (newx0c & 1) : (zc & 1)); bit5 = qshift ? ((q5 & 128) >> 7) : (bigcycle ? (newx0d & 1) : (zd & 1)); bit6 = qshift ? ((q6 & 128) >> 7) : (bigcycle ? (newx0e & 1) : (ze & 1)); bit7 = qshift ? ((q7 & 128) >> 7) : (bigcycle ? (newx0f & 1) : (zf & 1)); bit8 = qshift ? ((q8 & 128) >> 7) : (bigcycle ? (newx00 & 1) : (z0 & 1)); bit9 = qshift ? ((q9 & 128) >> 7) : (bigcycle ? (newx01 & 1) : (z1 & 1)); bita = qshift ? ((qa & 128) >> 7) : (bigcycle ? (newx02 & 1) : (z2 & 1)); bitb = qshift ? ((qb & 128) >> 7) : (bigcycle ? (newx03 & 1) : (z3 & 1)); bitc = qshift ? ((qc & 128) >> 7) : (bigcycle ? (newx04 & 1) : (z4 & 1)); bitd = qshift ? ((qd & 128) >> 7) : (bigcycle ? (newx05 & 1) : (z5 & 1)); bite = qshift ? ((qe & 128) >> 7) : (bigcycle ? (newx06 & 1) : (z6 & 1)); bitf = qshift ? ((qf & 128) >> 7) : (bigcycle ? (newx07 & 1) : (z7 & 1)); qshift2 = !bigcycle ^ (cycle < 12); bip0 = qshift2 ? ((q0 & 256) >> 8) : (bigcycle ? (newx08 >> 1) : (z8 >> 1)); bip1 = qshift2 ? ((q1 & 256) >> 8) : (bigcycle ? (newx09 >> 1) : (z9 >> 1)); bip2 = qshift2 ? ((q2 & 256) >> 8) : (bigcycle ? (newx0a >> 1) : (za >> 1)); bip3 = qshift2 ? ((q3 & 256) >> 8) : (bigcycle ? (newx0b >> 1) : (zb >> 1)); bip4 = qshift2 ? ((q4 & 256) >> 8) : (bigcycle ? (newx0c >> 1) : (zc >> 1)); bip5 = qshift2 ? ((q5 & 256) >> 8) : (bigcycle ? (newx0d >> 1) : (zd >> 1)); bip6 = qshift2 ? ((q6 & 256) >> 8) : (bigcycle ? (newx0e >> 1) : (ze >> 1)); bip7 = qshift2 ? ((q7 & 256) >> 8) : (bigcycle ? (newx0f >> 1) : (zf >> 1)); bip8 = qshift2 ? ((q8 & 256) >> 8) : (bigcycle ? (newx00 >> 1) : (z0 >> 1)); bip9 = qshift2 ? ((q9 & 256) >> 8) : (bigcycle ? (newx01 >> 1) : (z1 >> 1)); bipa = qshift2 ? ((qa & 256) >> 8) : (bigcycle ? (newx02 >> 1) : (z2 >> 1)); bipb = qshift2 ? ((qb & 256) >> 8) : (bigcycle ? (newx03 >> 1) : (z3 >> 1)); bipc = qshift2 ? ((qc & 256) >> 8) : (bigcycle ? (newx04 >> 1) : (z4 >> 1)); bipd = qshift2 ? ((qd & 256) >> 8) : (bigcycle ? (newx05 >> 1) : (z5 >> 1)); bipe = qshift2 ? ((qe & 256) >> 8) : (bigcycle ? (newx06 >> 1) : (z6 >> 1)); bipf = qshift2 ? ((qf & 256) >> 8) : (bigcycle ? (newx07 >> 1) : (z7 >> 1)); top0 = bigcycle ? z4 : newx04; top1 = bigcycle ? z5 : newx05; top2 = bigcycle ? z6 : newx06; top3 = bigcycle ? z7 : newx07; top4 = bigcycle ? z0 : newx00; top5 = bigcycle ? z1 : newx01; top6 = bigcycle ? z2 : newx02; top7 = bigcycle ? z3 : newx03; top8 = bigcycle ? zc : newx0c; top9 = bigcycle ? zd : newx0d; topa = bigcycle ? ze : newx0e; topb = bigcycle ? zf : newx0f; topc = bigcycle ? z8 : newx08; topd = bigcycle ? z9 : newx09; tope = bigcycle ? za : newx0a; topf = bigcycle ? zb : newx0b; newq0 = ((q0 & 124) >> 2) | ((crypto_uint11) bit0 << 5) | ((crypto_uint11) bip0 << 6) | ((q0 & 1536) >> 2) | ((crypto_uint11) top0 << 9); newq1 = ((q1 & 124) >> 2) | ((crypto_uint11) bit1 << 5) | ((crypto_uint11) bip1 << 6) | ((q1 & 1536) >> 2) | ((crypto_uint11) top1 << 9); newq2 = ((q2 & 124) >> 2) | ((crypto_uint11) bit2 << 5) | ((crypto_uint11) bip2 << 6) | ((q2 & 1536) >> 2) | ((crypto_uint11) top2 << 9); newq3 = ((q3 & 124) >> 2) | ((crypto_uint11) bit3 << 5) | ((crypto_uint11) bip3 << 6) | ((q3 & 1536) >> 2) | ((crypto_uint11) top3 << 9); newq4 = ((q4 & 124) >> 2) | ((crypto_uint11) bit4 << 5) | ((crypto_uint11) bip4 << 6) | ((q4 & 1536) >> 2) | ((crypto_uint11) top4 << 9); newq5 = ((q5 & 124) >> 2) | ((crypto_uint11) bit5 << 5) | ((crypto_uint11) bip5 << 6) | ((q5 & 1536) >> 2) | ((crypto_uint11) top5 << 9); newq6 = ((q6 & 124) >> 2) | ((crypto_uint11) bit6 << 5) | ((crypto_uint11) bip6 << 6) | ((q6 & 1536) >> 2) | ((crypto_uint11) top6 << 9); newq7 = ((q7 & 124) >> 2) | ((crypto_uint11) bit7 << 5) | ((crypto_uint11) bip7 << 6) | ((q7 & 1536) >> 2) | ((crypto_uint11) top7 << 9); newq8 = ((q8 & 124) >> 2) | ((crypto_uint11) bit8 << 5) | ((crypto_uint11) bip8 << 6) | ((q8 & 1536) >> 2) | ((crypto_uint11) top8 << 9); newq9 = ((q9 & 124) >> 2) | ((crypto_uint11) bit9 << 5) | ((crypto_uint11) bip9 << 6) | ((q9 & 1536) >> 2) | ((crypto_uint11) top9 << 9); newqa = ((qa & 124) >> 2) | ((crypto_uint11) bita << 5) | ((crypto_uint11) bipa << 6) | ((qa & 1536) >> 2) | ((crypto_uint11) topa << 9); newqb = ((qb & 124) >> 2) | ((crypto_uint11) bitb << 5) | ((crypto_uint11) bipb << 6) | ((qb & 1536) >> 2) | ((crypto_uint11) topb << 9); newqc = ((qc & 124) >> 2) | ((crypto_uint11) bitc << 5) | ((crypto_uint11) bipc << 6) | ((qc & 1536) >> 2) | ((crypto_uint11) topc << 9); newqd = ((qd & 124) >> 2) | ((crypto_uint11) bitd << 5) | ((crypto_uint11) bipd << 6) | ((qd & 1536) >> 2) | ((crypto_uint11) topd << 9); newqe = ((qe & 124) >> 2) | ((crypto_uint11) bite << 5) | ((crypto_uint11) bipe << 6) | ((qe & 1536) >> 2) | ((crypto_uint11) tope << 9); newqf = ((qf & 124) >> 2) | ((crypto_uint11) bitf << 5) | ((crypto_uint11) bipf << 6) | ((qf & 1536) >> 2) | ((crypto_uint11) topf << 9); x00[cycle] = newx00; x01[cycle] = newx01; x02[cycle] = newx02; x03[cycle] = newx03; x04[cycle] = newx04; x05[cycle] = newx05; x06[cycle] = newx06; x07[cycle] = newx07; x08[cycle] = newx08; x09[cycle] = newx09; x0a[cycle] = newx0a; x0b[cycle] = newx0b; x0c[cycle] = newx0c; x0d[cycle] = newx0d; x0e[cycle] = newx0e; x0f[cycle] = newx0f; x10[cycle] = newx10; x11[cycle] = newx11; x12[cycle] = newx12; x13[cycle] = newx13; x14[cycle] = newx14; x15[cycle] = newx15; x16[cycle] = newx16; x17[cycle] = newx17; x18[cycle] = newx18; x19[cycle] = newx19; x1a[cycle] = newx1a; x1b[cycle] = newx1b; x1c[cycle] = newx1c; x1d[cycle] = newx1d; x1e[cycle] = newx1e; x1f[cycle] = newx1f; q0 = newq0; q1 = newq1; q2 = newq2; q3 = newq3; q4 = newq4; q5 = newq5; q6 = newq6; q7 = newq7; q8 = newq8; q9 = newq9; qa = newqa; qb = newqb; qc = newqc; qd = newqd; qe = newqe; qf = newqf; carry0 = newcarry0; carry1 = newcarry1; carry2 = newcarry2; carry3 = newcarry3; carry4 = newcarry4; carry5 = newcarry5; carry6 = newcarry6; carry7 = newcarry7; carry8 = newcarry8; carry9 = newcarry9; carrya = newcarrya; carryb = newcarryb; carryc = newcarryc; carryd = newcarryd; carrye = newcarrye; carryf = newcarryf; } } } if (inlen >= 32) goto mainloop; inlenbelow32: if (finalization == 0) { for (i = 0;i < inlen;++i) tmp[i] = in[i]; tmp[i] = 128; for (++i;i < 32;++i) tmp[i] = 0; in = tmp; inlen = 32; finalization = 1; goto mainloop; } if (finalization == 1) { x1f[0] ^= 1; r = 32; finalization = 2; goto morerounds; } for (i = 0;i < 4;++i) { out[i ] = x00[4*i] | (x00[4*i+1] << 2) | (x00[4*i+2] << 4) | (x00[4*i+3] << 6); out[i + 4] = x01[4*i] | (x01[4*i+1] << 2) | (x01[4*i+2] << 4) | (x01[4*i+3] << 6); out[i + 8] = x02[4*i] | (x02[4*i+1] << 2) | (x02[4*i+2] << 4) | (x02[4*i+3] << 6); out[i + 12] = x03[4*i] | (x03[4*i+1] << 2) | (x03[4*i+2] << 4) | (x03[4*i+3] << 6); out[i + 16] = x04[4*i] | (x04[4*i+1] << 2) | (x04[4*i+2] << 4) | (x04[4*i+3] << 6); out[i + 20] = x05[4*i] | (x05[4*i+1] << 2) | (x05[4*i+2] << 4) | (x05[4*i+3] << 6); out[i + 24] = x06[4*i] | (x06[4*i+1] << 2) | (x06[4*i+2] << 4) | (x06[4*i+3] << 6); out[i + 28] = x07[4*i] | (x07[4*i+1] << 2) | (x07[4*i+2] << 4) | (x07[4*i+3] << 6); out[i + 32] = x08[4*i] | (x08[4*i+1] << 2) | (x08[4*i+2] << 4) | (x08[4*i+3] << 6); out[i + 36] = x09[4*i] | (x09[4*i+1] << 2) | (x09[4*i+2] << 4) | (x09[4*i+3] << 6); out[i + 40] = x0a[4*i] | (x0a[4*i+1] << 2) | (x0a[4*i+2] << 4) | (x0a[4*i+3] << 6); out[i + 44] = x0b[4*i] | (x0b[4*i+1] << 2) | (x0b[4*i+2] << 4) | (x0b[4*i+3] << 6); out[i + 48] = x0c[4*i] | (x0c[4*i+1] << 2) | (x0c[4*i+2] << 4) | (x0c[4*i+3] << 6); out[i + 52] = x0d[4*i] | (x0d[4*i+1] << 2) | (x0d[4*i+2] << 4) | (x0d[4*i+3] << 6); out[i + 56] = x0e[4*i] | (x0e[4*i+1] << 2) | (x0e[4*i+2] << 4) | (x0e[4*i+3] << 6); out[i + 60] = x0f[4*i] | (x0f[4*i+1] << 2) | (x0f[4*i+2] << 4) | (x0f[4*i+3] << 6); } return 0; }