Lightweight file fingerprinting for change detection.
Uses a size-mixed FNV-1a hash of up to three fixed-size blocks from the file (head, mid, tail) to efficiently detect modifications.
This fingerprint is intended as a fast heuristic: - It is not a cryptographic hash. - It trades perfect detection for performance on large trees. - Combining size + multiple sample blocks provides good practical coverage.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | private, | parameter | :: | BLOCK_SIZE | = | 4096 | |
| integer(kind=int64), | private, | parameter | :: | FNV_OFFSET | = | 1469598103934665603_int64 | |
| integer(kind=int64), | private, | parameter | :: | FNV_PRIME | = | 1099511628211_int64 | |
| character(len=1), | private, | allocatable, save | :: | io_buf(:) |
Compute a fingerprint for a file path.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | path |
Compute a key representing the current manifest-related configuration.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fpm_build_settings), | intent(in) | :: | settings | |||
| type(string_t), | intent(in), | allocatable | :: | files(:) |
Accept the new fingerprints for the subset of changed indices.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(inout) | :: | fp_prev(:) | |||
| integer(kind=int64), | intent(in) | :: | fp_now(:) | |||
| integer, | intent(in) | :: | changed_idx(:) | |||
| integer, | intent(in) | :: | changed_count |
Initialize fingerprint arrays for a watch list.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in), | allocatable | :: | files(:) | ||
| integer(kind=int64), | intent(inout), | allocatable | :: | fp_prev(:) | ||
| integer(kind=int64), | intent(inout), | allocatable | :: | fp_now(:) | ||
| integer, | intent(inout), | allocatable | :: | changed_idx(:) |
Scan files and return indices of changed entries.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(string_t), | intent(in), | allocatable | :: | files(:) | ||
| integer(kind=int64), | intent(in) | :: | fp_prev(:) | |||
| integer(kind=int64), | intent(inout) | :: | fp_now(:) | |||
| integer, | intent(inout) | :: | changed_idx(:) | |||
| integer, | intent(out) | :: | changed_count |
Mix a single 64-bit value into a 64-bit FNV-1a state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(inout) | :: | h | |||
| integer(kind=int64), | intent(in) | :: | x |
Mix a string into a 64-bit FNV-1a state.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(inout) | :: | h | |||
| character(len=*), | intent(in) | :: | s |
Hash a single file block at a specific stream position.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | u | |||
| integer(kind=int64), | intent(in) | :: | pos | |||
| integer, | intent(in) | :: | n | |||
| integer(kind=int64), | intent(inout) | :: | h |