3

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!

  • a+b no, but what about "ab", just combined. e.g. a=3 and b=6, then use "36"? (Only issue could be "a=0,b=36" --> you'd need to distinguish between 036 and 36 – Albert Renshaw Oct 11 '15 at 07:24

3 Answers3

3

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$

supinf
  • 13,433
1

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.

DRF
  • 5,167
0

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

Jonny
  • 2,519
  • but that has three inputs a,b,c, not two as the OP wanted – supinf Aug 12 '14 at 20:28
  • Yes caught that, right after I hit submit :( – Jonny Aug 12 '14 at 20:29
  • Wouldn't you be able to reverse that even if you just knew a+b and not a or b individually? – Pranav Marathe Aug 12 '14 at 20:38
  • I can't comment yet, apparently... but for your answer I believe the ambiguity you mention is not relevant since any number $d$ can be written as the sum of two numbers $(a+b)$ -- thus the OP's question is equivalent to taking $d$ as one input and $c$ as another. – Jonny Aug 12 '14 at 20:38