Here's the hash algo if that's all you needed. Also, I'm not certain which language you write in but either function will work with the extracted data just the same
**Read/write hash value as big endian uint32 (not int32, my mistake)
0x0 = Magic, 0x4 = Length, 0x8 = Hash
Code:
Function ComputeRE6Hash(ByRef Data As Byte()) As UInt32
If Data Is Nothing OrElse Data.Length = 0 Then Throw New NullReferenceException("Bad data")
Dim Magic As Byte() = New Byte() {&H12, 7, &H18, 0} '//Magic bytes @ 0x0
For i As Int32 = 0 To 4 - 1 '//Check magic
If Magic(i) <> Data(i) Then Throw New Exception("Invalid RE6 data")
Next
Dim Buffer(4 - 1) As Byte, Length As Int32, Hash As Int64 '//Declare Hash as int64 to prevent overflows/underflows
Array.Copy(Data, 4, Buffer, 0, 4) '//Data length int @ 0x4
Array.Reverse(Buffer)
Length = BitConverter.ToInt32(Buffer, 0)
For i As Int32 = &HC To Length - 1 '//Begin calculating from 0xC for specified length
Hash += ((Data(i) And &HFF) << (24 - ((i And 3) * 8)))
Next
Do While Hash > &H100000000L
Hash -= &H100000000L
Loop
Erase Buffer
Return CUInt(Hash) '//Cast to uint
End Function
Code:
uint ComputeRE6Hash(ref byte[] Data)
{
if(Data == null || Data.Length == 0) throw new NullReferenceException("Bad data");
byte[] Magic = new byte[] {0x12, 7, 0x18, 0}; //Magic bytes @ 0x0
for(int i = 0; i < 4; i++) //Check magic
{
if(Magic[i] != Data[i]) throw new Exception("Invalid RE6 data");
}
byte[] Buffer = new byte[4]; int Length = 0; long Hash = 0; //Declare Hash as int64 to prevent overflows/underflows
Array.Copy(Data, 4, Buffer, 0, 4); //Data length int @ 0x4
Array.Reverse(Buffer);
Length = BitConverter.ToInt32(Buffer, 0);
for(int i = 0xC; i < Length; i++) //Begin calculating from 0xC for specified length
{
Hash += ((Data[i] & 0xFF) << (24 - ((i & 3) * 8)));
}
while (Hash > 0x100000000)
{
Hash -= 0x100000000;
}
Array.Clear(Buffer, 0, 4);
return (uint)Hash; //Cast to uint
}