Is there a system that has modular inverses for non prime mods?
Ultimately what I am trying to do is design a hash function that given a list of n outputs (mod m) and inputs (large arbitrary integers), can efficiently compute some salt such that the hash function would map all inputs to the desired outputs. I also want the entropy of the this salt to be as small as possible. So on average, $\log salt = \log m^n$.
One idea that works perfectly for prime mods is to convert the salt to base m, and take the dot product with the input base m. Then take this value mod m. The salt can be found by solving a system of linear equations mod m. But to do this requires an inverse which only exist for prime m's.
In more mathy notation:
- salt can be turned into a vector, x by converting it to base m.
- inputs can form a matrix "A" (let's call a specific row lowercase "a") by turning each input into a sequence mod m (either by repeatedly hashing it or if it is large enough converting to base m). Match its length to x.
- let y = the outputs
- hash function = $a \cdot x\mod m$
- to solve for x, just solve, $Ax=y\mod m$
There may be other ideas to achieve this goal. Also I'm not sure if this is the correct place to ask this question, other ideas would be in crypto.
The purpose of this algorithm is to design a more space efficient "perfect hashing" method for read only values and I think if it can be solved would deserve a paper to be written, credit would be due to any answers!