fetch_ml/native/dataset_hash/io/file_hash.h
Jeremie Fraeys 43d241c28d
feat: implement C++ native libraries for performance-critical operations
- Add arena allocator for zero-allocation hot paths
- Add thread pool for parallel operations
- Add mmap utilities for memory-mapped I/O
- Implement queue_index with heap-based priority queue
- Implement dataset_hash with SIMD support (SHA-NI, ARMv8)
- Add runtime SIMD detection for cross-platform correctness
- Add comprehensive tests and benchmarks
2026-02-16 20:38:04 -05:00

24 lines
678 B
C

#pragma once
#include "../crypto/sha256_hasher.h"
#include <stddef.h>
#include <stdint.h>
// Hash a single file using mmap with fallback to buffered read
// out_hash must be 65 bytes (64 hex + null)
// Returns 0 on success, -1 on error
int hash_file(const char* path, size_t buffer_size, char* out_hash);
// Hash multiple files, returning individual hashes
// out_hashes must be pre-allocated with count * 65 bytes
int hash_files_batch(
const char* const* paths,
uint32_t count,
char** out_hashes, // Array of 65-char buffers
size_t buffer_size
);
// Configuration for hash operations
struct HashConfig {
size_t buffer_size;
uint32_t num_threads;
};