# Is PRF XORed with its key still a PRF? (always)

$$\forall k \in \{0,1\}^n,m \in \mathbb{M},F_k(m)$$ is defined as follows: $$F_k(m) = F'_k(m) \oplus k$$. It is known that $$F'_k$$ is a PRF. Note: 𝕄 is the message space and it's assumed that the key $$k$$ is generated by some Gen algorithm in a random manner.

Must $$F_k(m)$$ be a PRF too?

I have an intuition that the answer is yes as it does not feel like changing the distribution of the output, but any kind of reduction requires the key in order to simulate $$F$$ and get into contradiction somehow (up to my level of knowledge - Ba student first course in the topic). So I guess maybe the answer is actually no, but might be out of my knowledge... what can be a good approach here?

No.

Let $$||$$ denote the concatenation. Let $$F''$$ be a PRF on the domain $$\mathbb{M} \times \{0,1\}$$. Fix any "special message" $$m^* \in \mathbb{M}$$. Consider the following construction for $$F'$$: the key of $$F'$$ is $$k_0 || k_1$$, where $$k_0$$ is a random key for $$F''$$, and $$k_1$$ is a random string of the same length. On input $$m \in \mathbb{M}$$, $$F'_{k_0||k_1}(m)$$ outputs $$F''_{k_0}(m||0) || k_1$$ if $$m = m^*$$, and $$F''_{k_0}(m||0) || F''_{k_0}(m||1)$$ otherwise.

First, observe that $$F'$$ is still a PRF. It follows directly from the security of $$F''$$, and by observing that $$k_1$$ is truly random and is used only once, on the special input $$m = m^*$$.

Second, let $$F_{k_0||k_1}: m \rightarrow F'_{k_0||k_1}(m) \oplus (k_0 || k_1)$$. This is clearly not a PRF, because the second half of $$F_{k_0||k_1}(m^*)$$ is a string of zeroes (which is very unlikely to happen for a random function).

(I'm glossing over minor details about what we assume on the length of the keys, since it's not hard to handle it, just a bit more tedious).

• Thank you , it's truly a great explanation . I'm wondering what would be the answer for the same question but instead of talking about PRFs , we would talk about Mac schemes which means replacing the notation of $F'$ with $Mac'$ , and given a secure Mac scheme $Mac$ instead of a PRF $F$. In this case ths Mac will remain secure ? ( Note that using the exact same construction will not work here ) Jul 1 at 14:35
• Referring to my previous comment , I think I built a similar construction which works as well , to show that it also not must be a secure Mac scheme Jul 1 at 14:57
• Good if you could find it yourself! Finding these counter examples yourself helps building an understanding of security arguments in cryptography. Also, I should point out that if you're asking yourself these questions for the purpose of better understanding the primitives, I think it's a very nice and healthy approach. Jul 2 at 10:56