ta/wallet_ta.c
/** Update hash value based on the contents of a full message buffer.
  * \param hs The hash state to update.
  */
Update hash value based on the contents of a full message buffer.
\param hs The hash state to update.
Update hash value based on the contents of a full message buffer . \ param hs The hash state to update .
static void ripemd_160_block_internal(HashState *hs)
{
	uint32_t A1, B1, C1, D1, E1;
	uint32_t A2, B2, C2, D2, E2;
	uint32_t K1, K2, R1, R2;
	uint32_t T;
	uint8_t fn_selector;
	uint8_t j;
	A1 = hs->h[0];
	A2 = A1;
	B1 = hs->h[1];
	B2 = B1;
	C1 = hs->h[2];
	C2 = C1;
	D1 = hs->h[3];
	D2 = D1;
	E1 = hs->h[4];
	E2 = E1;
	for (j = 0; j < 80; j++)
	{
		fn_selector = (uint8_t)(j >> 4);
		switch(fn_selector)
		{
			case 0:
				R1 = f0(B1, C1, D1);
				R2 = f4(B2, C2, D2);
				K1 = 0x00000000;
				K2 = 0x50a28be6;
				break;
			case 1:
				R1 = f1(B1, C1, D1);
				R2 = f3(B2, C2, D2);
				K1 = 0x5a827999;
				K2 = 0x5c4dd124;
				break;
			case 2:
				R1 = f2(B1, C1, D1);
				R2 = f2(B2, C2, D2);
				K1 = 0x6ed9eba1;
				K2 = 0x6d703ef3;
				break;
			case 3:
				R1 = f3(B1, C1, D1);
				R2 = f1(B2, C2, D2);
				K1 = 0x8f1bbcdc;
				K2 = 0x7a6d76e9;
				break;
			default:
				R1 = f4(B1, C1, D1);
				R2 = f0(B2, C2, D2);
				K1 = 0xa953fd4e;
				K2 = 0x00000000;
				break;
		}
		T  = rol(A1 + R1 + hs->m[LOOKUP_BYTE(r1[j])] + K1, LOOKUP_BYTE(s1[j])) + E1;
		A1 = E1;
		E1 = D1;
		D1 = rol(C1, 10);
		C1 = B1;
		B1 = T;
		T  = rol(A2 + R2 + hs->m[LOOKUP_BYTE(r2[j])] + K2, LOOKUP_BYTE(s2[j])) + E2;
		A2 = E2;
		E2 = D2;
		D2 = rol(C2, 10);
		C2 = B2;
		B2 = T;
	}
	T = hs->h[1] + C1 + D2;
	hs->h[1] = hs->h[2] + D1 + E2;
	hs->h[2] = hs->h[3] + E1 + A2;
	hs->h[3] = hs->h[4] + A1 + B2;
	hs->h[4] = hs->h[0] + B1 + C2;
	hs->h[0] = T;
}
static void ripemd_160_block_internal ( HashState * hs ) { uint32_t A1 , B1 , C1 , D1 , E1 ; uint32_t A2 , B2 , C2 , D2 , E2 ; uint32_t K1 , K2 , R1 , R2 ; uint32_t T ; uint8_t fn_selector ; uint8_t j ; A1 = hs -> h [ 0 ] ; A2 = A1 ; B1 = hs -> h [ 1 ] ; B2 = B1 ; C1 = hs -> h [ 2 ] ; C2 = C1 ; D1 = hs -> h [ 3 ] ; D2 = D1 ; E1 = hs -> h [ 4 ] ; E2 = E1 ; for ( j = 0 ; j < 80 ; j ++ ) { fn_selector = ( uint8_t ) ( j >> 4 ) ; switch ( fn_selector ) { case 0 : R1 = f0 ( B1 , C1 , D1 ) ; R2 = f4 ( B2 , C2 , D2 ) ; K1 = 0x00000000 ; K2 = 0x50a28be6 ; break ; case 1 : R1 = f1 ( B1 , C1 , D1 ) ; R2 = f3 ( B2 , C2 , D2 ) ; K1 = 0x5a827999 ; K2 = 0x5c4dd124 ; break ; case 2 : R1 = f2 ( B1 , C1 , D1 ) ; R2 = f2 ( B2 , C2 , D2 ) ; K1 = 0x6ed9eba1 ; K2 = 0x6d703ef3 ; break ; case 3 : R1 = f3 ( B1 , C1 , D1 ) ; R2 = f1 ( B2 , C2 , D2 ) ; K1 = 0x8f1bbcdc ; K2 = 0x7a6d76e9 ; break ; default : R1 = f4 ( B1 , C1 , D1 ) ; R2 = f0 ( B2 , C2 , D2 ) ; K1 = 0xa953fd4e ; K2 = 0x00000000 ; break ; } T = rol ( A1 + R1 + hs -> m [ LOOKUP_BYTE ( r1 [ j ] ) ] + K1 , LOOKUP_BYTE ( s1 [ j ] ) ) + E1 ; A1 = E1 ; E1 = D1 ; D1 = rol ( C1 , 10 ) ; C1 = B1 ; B1 = T ; T = rol ( A2 + R2 + hs -> m [ LOOKUP_BYTE ( r2 [ j ] ) ] + K2 , LOOKUP_BYTE ( s2 [ j ] ) ) + E2 ; A2 = E2 ; E2 = D2 ; D2 = rol ( C2 , 10 ) ; C2 = B2 ; B2 = T ; } T = hs -> h [ 1 ] + C1 + D2 ; hs -> h [ 1 ] = hs -> h [ 2 ] + D1 + E2 ; hs -> h [ 2 ] = hs -> h [ 3 ] + E1 + A2 ; hs -> h [ 3 ] = hs -> h [ 4 ] + A1 + B2 ; hs -> h [ 4 ] = hs -> h [ 0 ] + B1 + C2 ; hs -> h [ 0 ] = T ; }
Update hash value based on the contents of a full message buffer.
Update hash value based on the contents of a full message buffer .