# Secure mapping functions

I have two secret numbers $$A$$ and $$B$$. Both are uniformly-distributed 32-bit numbers.

I need a deterministic function $$f(x)$$ such that $$f(A) = B$$. $$f(x)$$ must not leak any information about $$A$$ or $$B$$.

Naively, what if $$f(x) = x + C$$, where $$C = B - A$$. What information is leaked, if any, in this case, and what would be a better $$f(x)$$?

• How many times are you planning on invoking a given $f(x)$ for different $x$? Also, be aware that 32-bit numbers are typically small enough to brute-force, so the security here is not very substantial. Commented Dec 1, 2023 at 20:25
• Does $f$ need to be pseudorandom? If you don't want "information to leak" then you have to be specific about what the adversary is allowed to do/see. Also note that you can "translate" any function $f$ into $f'(x) = f(x) + B - f(A)$ so that $f'(A)= B$. Commented Dec 1, 2023 at 20:43
• Your naive example leaks at least $B-A$ by evaluating $f$ on $x=0$. Commented Dec 1, 2023 at 20:51