Documentation
¶
Index ¶
- func ComputeChunkHash(data []byte) string
- func ReassembleChunks(chunks [][]byte) []byte
- func ShouldChunk(fileSize int64, thresholdBytes int64) bool
- func SplitFile(data []byte, chunkSizeBytes int) [][]byte
- func VerifyChunkIntegrity(chunk []byte, meta ChunkMetadata) error
- func VerifyChunks(chunks [][]byte, expectedFileHash string) error
- type ChunkDiff
- type ChunkMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeChunkHash ¶
ComputeChunkHash computes SHA256 hash of chunk data
func ReassembleChunks ¶
ReassembleChunks combines chunks back into a single file
func ShouldChunk ¶
ShouldChunk returns true if a file should be chunked based on threshold
func VerifyChunkIntegrity ¶
func VerifyChunkIntegrity(chunk []byte, meta ChunkMetadata) error
VerifyChunkIntegrity verifies a single chunk against its metadata
func VerifyChunks ¶
VerifyChunks verifies that chunks reassemble to the expected file hash
Types ¶
type ChunkDiff ¶
type ChunkDiff struct {
Index int // Chunk index
Data []byte // Diff data for this chunk
Hash string // Hash of the diff data
}
ChunkDiff represents a diff for a single chunk
type ChunkMetadata ¶
type ChunkMetadata struct {
FileHash string // SHA256 hash of the entire file
ChunkIndex int // Index of this chunk (0-based)
TotalChunks int // Total number of chunks in the file
ChunkSize int // Size of this chunk in bytes
ChunkHash string // SHA256 hash of this chunk's data
}
ChunkMetadata contains metadata about a file chunk
func CreateMetadata ¶
func CreateMetadata(fileData []byte, chunks [][]byte) []ChunkMetadata
CreateMetadata creates metadata for chunks
Click to show internal directories.
Click to hide internal directories.