Irreversible Math Function

1.6k Views Asked by At

Is there any function which will take two inputs, (a+b) as one input and c as another, and return a result from which c can only be computed only if a and/or b are known individually?

Basically I want to modify c with (a+b) in such a way that you have to know a and b individually to get c back.

Thanks in advance!

3

There are 3 best solutions below

1
On BEST ANSWER

if i understand you right, that is not possible. if you take a=3, b=5, c=7, it is the same thing as if you take a=4,b=4, c=7

that means, if you are able to get c if you know the real $a_1$ and $b_1$, you can get the same c if you use "wrong" a,b, lets say $a_2,b_2$ such that $a_1+b_1 = a_2 b_2$

4
On

Pick your favorite hash function $f$, then something like $f(a + b) + c$ will do just fine.

0
On

While this might be more suitable as a comment I feel the point is so important I decided to post it as an answer.

If you want a one-way function for actual cryptographic purposes, whatever they are, and it even crosses your mind to ask on a forum what one could be satisfying whatever constraints you have come up with, you want to stop what you are doing.

Any home-brewed cryptographic protocol, function, doo-hicky or algorithm, is almost certain to be bad. And here I'm using almost in the mathematical meaning i.e. given an infinite set, for all but finitely many.

If you have a problem that needs a cryptographic solution and you haven't spent the last 10 years doing cryptography, you want to find a well known, preferably widely used and supported, protocol, function, doo-hicky or algorithm and use that. Not only is it a lot less likely to be fatally flawed, but chances are when it is discovered to be flawed it will be published, you will find out about it and be able to react appropriately (patching, updating, migrating wvr.)

While people often realize this in case of algorithms and functions, possibly the most problematic situation is protocols. You just have to look around to notice that even some of the smartest people around have issues coming up with safe protocols so chances are anything one comes up with on their own will be so full of holes it will resemble a grate more then a sieve.