Open nyurik opened 7 months ago
faster fnv1a checksum algorithm
In tippecanoe we needed a content hash that had the smallest implementation to inline, unsure how the speed compares to md5, but if you need speed you'll probably want something like xxhash anyways.
@bdon this proposal is to support and standardize all such algorithms, so that if tippecanoe created mbtiles file, other tools can validate it and possibly add more content, while using the same algo as the original
mbtiles
andmartin-cp
standardize how a tile data is hashed in the mbtiles.tilelive-copy
has been generating normalized mbtiles schema with MD5 hashes of the tile data as the table foreign key. So it was possible to validate the content of the tile by re-computing MD5 hash.tippecanoe (cc @bdon) has used a faster fnv1a checksum algorithm, so clearly there is need for more than one algo.
Proposal
hash_algorithm
metadata value with the possible valuesmd5
,fnv1a
, ...Multiple Algorithms Consideration
MBTiles use hashes for the
tile_data
column and for theagg_tiles_hash
metadata field. In theory these could use different algorithms for performance and security(?) reasons. If so, we could either have two metadata fields (hash_algorithm
andagg_hash_algorithm
), or better yet, renameagg_tiles_hash
intoagg_tiles_hash_md5
(or other algo). This keeps the algorithm and its value together, and is fairly easy to detect at runtime.