# Hash function over numbers that preserve addition and multiplication

I wonder if there is a known hash function that for any $$x$$, $$y$$ which are numbers in a certain range with certain accuracy (I guess one can think of them as integers?), you can define two functions corresponding to addition and multiplication such that:

$$h(x) \# h(y) = h(x+y)$$

and

$$h(x) \cdot\cdot h(y) = h(x \cdot y)$$.

Edit: I now see it is slightly duplicated with Is it possible to subtract/multiply numbers using homomorphic encryption?

• What security properties are you looking for this 'hash function'? Preimage, second preimage, collision resistance? Something that actually has a fixed output length independent of the input size? – poncho Oct 1 '19 at 20:58
• It is not duplicate, they are not hash function. – kelalaka Oct 1 '19 at 21:08
• I remember a similar question but couldn't find it. – kelalaka Oct 1 '19 at 21:24
• I agree with poncho here; I don't see how you can have such a hash function without dropping at least some of the common properties of a generic cryptographically secure hash function. – Maarten Bodewes Oct 1 '19 at 21:38
• Possible duplicate of Are there any practical implementation of a homomorphic hashing or signature scheme? – Squeamish Ossifrage Oct 1 '19 at 22:08