// 
unsigned long decode_dead_03_bl(unsigned char  *rap,
								unsigned char  *key,
								unsigned char  *hash,								
								unsigned char  *sl_in,
								unsigned short  sl_in_size,
								char		   *ret)
{
	unsigned char	buff_m[0x1000],area_hash[20];
	uchar 			ucCode[16],i,j;
	uchar			*pCodes;

	//DebugPrintHexArray(hash,20,"hash");
	//DebugPrintHexArray(rap,20,"rap");
	//DebugPrintHexArray(key,20,"key");
	//DebugPrintHexArray(sl_in,sl_in_size,"in data");
	
CRYPT_START

	// init key size
	Nr = 128;
	Nk = Nr / 32;
	Nr = Nk + 6;

	dead04[14] = 0x03;
	tz_generate_unique_key_34_single_hashing(AesKey,rap,key,NULL);
	dead04[14] = 0x04;

	// Expansion
	KeyExpansion();

	// Init IV - comes from block header
	memcpy(aes_iv,sl_in + 8,16);
	//DebugPrintHexArray(aes_iv,16,"iv");

	// Decode dead03 - remove header
	decode_block(sl_in + 0x20,sl_in_size - 0x20,aes_iv,buff_m);
	//DebugPrintHexArray(buff_m,sl_in_size - 0x20,"out data");

	//DebugPrintHexArray(sl_in + 0x04,0x1C,"");
	//DebugPrintHexArray(buff_m,sl_in_size - 0x30,"");

	// Hash plain
	sha.reset();
	sha.add(sl_in + 0x04,0x1C);				// Header
	sha.add(buff_m,sl_in_size - 0x30);		// Decoded
	sha.final(area_hash);
	//DebugPrintHexArray(area_hash,16,"");

CRYPT_END

	// Test hashes
	if(memcmp(buff_m + 0x80,area_hash,16) != 0)
		return 1;

	// Return decoded block
	memcpy(sl_in,buff_m,0x50);

	return 0;	
}
