Skip to content

MeowU64From only returns the first 64 bytes of the hash #74

Open
@Clark-E

Description

@Clark-E

When trying to get the result of a computed hash using MeowU64From, only the first 64 bytes are returned, regardless of the value of the second function argument.

Here's a simple c/c++ program I wrote to demonstrate the issue:

#include <iostream>
#include "meowHash.h" //the header file that contains the Meow Hash source code

void main(){
	
	//fill buffer with data.
	
	int bufferSize = 50;
	
	char* buffer = (char*)malloc(bufferSize);
	
	for(int i = 0; i < bufferSize; i++){
		
		buffer[i] = i;
		
	}
	
	//hash and print.
	
	meow_u128 hash = MeowHash(MeowDefaultSeed,bufferSize,buffer);
	
	long long unsigned hash1 = MeowU64From(hash,0);
	long long unsigned hash2 = MeowU64From(hash,1);
	
	std::cout << std::hex << hash1 << " " << hash2 << std::dec << std::endl;
	
	long unsigned hash3 = MeowU32From(hash,0);
	long unsigned hash4 = MeowU32From(hash,1);
	long unsigned hash5 = MeowU32From(hash,2);
	long unsigned hash6 = MeowU32From(hash,3);
	
	std::cout << std::hex << hash3 << " " << hash4 << " " << hash5 << " " << hash6 << std::dec << std::endl;
	
}

When run, it produces this output:

f977fc4881456a98 f977fc4881456a98
81456a98 f977fc48 d3d8ef6a 4e7a8b47

The U32 parts can be accessed fine, but trying to access the hash as a pair of U64 parts does not work, as it instead only returns the first 64 bytes.

Compiler: Microsoft Visual Studio Community 2019 16.4.5 using Visual C++ 2019
CPU: Intel Core i5-9300H CPU
OS: 64 bit Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions