Skip to content

Use alternative FNV64-based hash.#18

Closed
gouttegd wants to merge 2 commits intomainfrom
fnv64-hash
Closed

Use alternative FNV64-based hash.#18
gouttegd wants to merge 2 commits intomainfrom
fnv64-hash

Conversation

@gouttegd
Copy link
Copy Markdown
Owner

@gouttegd gouttegd commented Apr 10, 2026

This PR tentatively enables the use of the FNV64 hash function, rather than SHA2-256, to compute the hash of a mapping record.

While FNV64 is not a cryptographic hash function, this should not be an issue for what we are doing here – we do not, in fact, need the cryptographic properties of SHA2-256.

So for now, the MappingHasher can work in two mode:

  • default mode, producing a ZBase32-encoded SHA2-256 hash;
  • “FNV mode” (enabled by MappingHasher(true)), producing a hex-encoded FNV64 hash.

The %{hash} mapping formatter in SSSOM/T and the mapping.special(hash) extractor in SSSOM/CLI are still hardwired to the default. The FNV hash can be required with %{hexhash} and mapping.special(hexhash). In both cases, this may change later.

The fate of this PR will depend on what the SSSOM folks have to say about using FNV64 for computing the “standard SSSOM hash”. :)

@gouttegd gouttegd force-pushed the fnv64-hash branch 4 times, most recently from 2007c38 to 782683a Compare April 10, 2026 21:32
Tentatively use the FNV64 hash function, rather than SHA2-256, to
compute the hash of a mapping record.

While FNV64 is not a _cryptographic_ hash function, this should not be
an issue for what we are doing here -- we do not, in fact, need the
cryptographic properties of SHA2-256.

So for now, the `MappingHasher` can work in two mode:

* default mode, producing a ZBase32-encoded SHA2-256 hash;
* "FNV mode" (enabled by `MappingHasher(true)`), producing a hex-encoded
  FNV64 hash.

The `%{hash}` mapping formatter in SSSOM/T and the
`mapping.special(hash)` extractor in SSSOM/CLI are still hardwired to
the default. The FNV hash can be required with `%{hexhash}` and
`mapping.special(hexhash)`.
@gouttegd
Copy link
Copy Markdown
Owner Author

Superseded by commit 6e1c4b5, which allows coexistence of both the SHA256-based hash and the FNV64-based hash at the same time (at least until a decision is reached on the SSSOM spec).

@gouttegd gouttegd closed this Apr 12, 2026
@gouttegd gouttegd deleted the fnv64-hash branch April 12, 2026 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant