library/src/filesystem/BP-Filesystem.cc
// Simple routine used for performing sha1 match verifications against
// files that exist on the filesystem.  The sha1_compare_match_buffer parameter
// must contain a sha1 hash (40 bytes long + null terminator) which will be
// matched against a hash generated directly via file-read.
Simple routine used for performing sha1 match verifications against
files that exist on the filesystem.  The sha1_compare_match_buffer parameter
must contain a sha1 hash (40 bytes long + null terminator) which will be
matched against a hash generated directly via file-read.
Simple routine used for performing sha1 match verifications against files that exist on the filesystem . The sha1_compare_match_buffer parameter must contain a sha1 hash ( 40 bytes long + null terminator ) which will be matched against a hash generated directly via file - read .
BP_ERROR_T BP_FileSHA1ContentsAndAttemptMatch
(
		char *file_path,
		char *sha1_compare_match_buffer
)
{
	if(!sha1_compare_match_buffer)
		return ERR_FAILURE;
	char sha1_ret_buff[41];
	BP_ZERO_STACK(sha1_ret_buff);
	if(!BP_FileSHA1Contents(file_path, (char *) &sha1_ret_buff))
		return ERR_FAILURE;
	if(memcmp(&sha1_ret_buff, sha1_compare_match_buffer, 40) != 0)
		return ERR_FAILURE;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_FileSHA1ContentsAndAttemptMatch ( char * file_path , char * sha1_compare_match_buffer ) { if ( ! sha1_compare_match_buffer ) return ERR_FAILURE ; char sha1_ret_buff [ 41 ] ; BP_ZERO_STACK ( sha1_ret_buff ) ; if ( ! BP_FileSHA1Contents ( file_path , ( char * ) & sha1_ret_buff ) ) return ERR_FAILURE ; if ( memcmp ( & sha1_ret_buff , sha1_compare_match_buffer , 40 ) != 0 ) return ERR_FAILURE ; return ERR_SUCCESS ; }
Simple routine used for performing sha1 match verifications against
files that exist on the filesystem.
Simple routine used for performing sha1 match verifications against files that exist on the filesystem .
// ensure we have a buffer to match // create space to hold buffer // ensure we can create sha1 // ensure the buffers match // return indicating success