Add new comment

My solution

I stripped down the unprocessed_raw sample and achieved what I want (I think) by piping the output through a hash utility like sha256sum or xxh128sum.

Posting here in case it helps someone later:

#include <stdio.h>
#include "libraw/libraw.h"
int main(int ac, char *av[])
{
	LibRaw RawProcessor;
	int ret;  
	if ((ret = RawProcessor.open_file(av[1])) != LIBRAW_SUCCESS)  
	{
		fprintf(stderr, "Cannot open %s: %s\n", av[1], libraw_strerror(ret));  
		return 1;  
	}
	if ((ret = RawProcessor.unpack()) != LIBRAW_SUCCESS)  
	{
		fprintf(stderr, "Cannot unpack %s: %s\n", av[1], libraw_strerror(ret));  
		return 1;  
	}
	size_t bytes = RawProcessor.imgdata.sizes.raw_height * RawProcessor.imgdata.sizes.raw_pitch;  
	fwrite(RawProcessor.imgdata.rawdata.raw_alloc, sizeof(uint8_t), bytes, stdout);  
	fflush(stdout);
}

Compile with g++ rawbytes.cpp -o rawbytes -Ofast -lraw -lm.