|
TARFS 0.1.5
Read-only TAR filesystem for ESP32
|
#include <stdint.h>#include <stddef.h>Go to the source code of this file.
Macros | |
| #define | HASH32_IV (uint32_t)(2166136261u) |
| 1) CRC64/ECMA182 algorithm implementation (no tables version, slow but memory-efficient 2) Optimized variation of the FNV-1a hash algorithm. | |
| #define | HASH32_SLASH (uint32_t)(0x2a0c975eu) |
| #define | HASH64_IV 0ULL |
Functions | |
| uint32_t | hash32 (uint32_t prev_hash, uint8_t const *data, size_t len) |
| Compute FNV-1a hash over a byte buffer. | |
| uint64_t | hash64 (uint64_t prev_hash, void const *data, size_t len) |
| Compute CRC64/ECMA182 hash over a byte buffer. | |
| #define HASH32_IV (uint32_t)(2166136261u) |
1) CRC64/ECMA182 algorithm implementation (no tables version, slow but memory-efficient 2) Optimized variation of the FNV-1a hash algorithm.
Init vector for 32bit hash
Definition at line 28 of file hash.h.
Referenced by inode_lookup(), and inode_populate().
| #define HASH32_SLASH (uint32_t)(0x2a0c975eu) |
Hash32 value of a single-character C-string "/". NOTE: must be recomputed if hash32 algo is changed!
Definition at line 29 of file hash.h.
Referenced by inode_mount().
| uint32_t hash32 | ( | uint32_t | prev_hash, |
| const uint8_t * | data, | ||
| size_t | len ) |
Compute FNV-1a hash over a byte buffer.
This function supports incremental hashing:
h = hash32(HASH32_IV, data1, len1); h = hash32(h, data2, len2); h = hash32(h, data3, len3); ....
| prev_hash | initial hash state (use HASH32_IV for fresh hash) |
| data | Input byte buffer |
| len | Length of input buffer |
This function supports incremental hashing:
h = hash32(HASH32_IV, data1, len1); h = hash32(h, data2, len2); h = hash32(h, data3, len3); ....
| prev_hash | previous hash value (use HASH32_IV for fresh hash) |
| data | Input byte buffer |
| len | Length of input buffer |
Definition at line 79 of file hash.c.
References HASH32_CSTEP, HASH32_PSTEP, and HASH32_RETURN_IF_DONE.
Referenced by inode_lookup(), and inode_populate().
| uint64_t hash64 | ( | uint64_t | prev_crc, |
| void const * | buffer0, | ||
| size_t | buf_len ) |
Compute CRC64/ECMA182 hash over a byte buffer.
CRC-64/ECMA-182 algoritm.
This function supports incremental hashing:
h = hash64(HASH64_IV, data1, len1); h = hash64(h, data2, len2); h = hash64(h, data3, len3); ....
| prev_hash | initial hash state (use HASH32_IV for fresh hash) |
| data | Input byte buffer |
| len | Length of input buffer |
Compute CRC64/ECMA182 hash over a byte buffer.
Used for data integrity verification This is the reference software implementation of 64bit CRC, no tables. It is slower than table version but it does not use extra ram and speed here is not an issue as this functions is usually called by tarfs_fsck() code
Definition at line 163 of file hash.c.
Referenced by tar_baddata().