-1
$\begingroup$

First of all, sorry for any horrible formatting, I have to type this in from my phone.

I know (or, at least, I think) that no currently used cryptographically secure hash functions exist with this property, and I doubt it would make sense if they did, but I want to know if there is any kind of "hash"-like function that does.

Is there any function where if $x+y=z$, then $f^{-1}(f(x) + f(y))=z$? (Or some other operator: subtraction, AND, OR, etc, if that makes the question easier to answer) Other than something trivial like $f(x)=x$.

It would seem to me that such a function would likely be very susceptible to attack, although I do not know this for sure, but I do not plan on using it for anything that requires even a tiny amount of legit security.

Based on what I know about functions and algorithms, I would hazard a guess that such a function would need to be linear, but I don't know that for sure. I am looking for some sort of "hash"-like function to be able to store information (text, numbers, etc) in fixed sized pieces but still be able to do operations on them (adding, subtracting, etc) in that "hashed" state. Even if you only have some general information on where to look, that would be appreciated.

$\endgroup$
0
1
$\begingroup$

The fact that you want an inverse function means hashing is not appropriate, as hashes are by definition not invertible due to the requirement of preimage resistance.

What you're looking for is homomorphic encryption. What operations you need to perform will determine what scheme you need to use. There is fully homomorphic encryption, which allows you to evaluate whatever operator you want, but it is relatively inefficient compared to schemes that only offer a specific operator (such as addition or multiplication).

$\endgroup$
1
  • $\begingroup$ I wasn't sure of the terminology of the type of function I wanted, hence the quotes every time I said "hash" $\endgroup$ – runeguy Jun 11 '18 at 19:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.