3 ms·
I tailored my response so someone without a rigorous math background could come to a useful understanding of the limitations of computers. Most of the arbitrar
by than3 4y ago
I tailored my response so someone without a rigorous math background could come to a useful understanding of the limitations of computers.
Most of the arbitrary length input to fixed output hashing for non-randomized data that I've seen use modulo p primes which compose a Galois field.
More specifically this is done to reduce collisions and so they do not cluster with non-random input data, randomized data doesn't have this problem. Its done so those output keys are uniformly distributed across the fixed space as modular arithmetic tends to cluster around the divisors.
Perfect hash functions are injective by definition and they maintain the same properties determinism requires (1:1 mapping) but they also require fixed input and fixed output.
They do work but have fairly narrow and limited practical use and I don't see how they are particularly relevant to OP's question, it seems like unnecessary academic rigor that gets in the way of the intuitive point.
OP's question involved hashing algorithms that have collisions, perfect hash function guarantees no collisions.
I hope that clarifies the extent of how Galois fields relate to this. There are of course hash functions that are not Galois fields that have collisions, and you are right they do not meet that 1:1 mapping required for both injective functions and determinism system properties, those reduce to a Turing machine halting problem axiom and a violation of determinism when 1 state corresponds to many potential states.
I mentioned Galois fields simply because they are often and historically have been commonly used for their useful properties.