2

I'm new to cryptanalysis and I saw in another answer to a question that $f: \lbrace0, 1\rbrace^{\kappa}\to \lbrace0, 1\rbrace^{\kappa}, f(x) = 1^{\kappa} $ is a one way function. Why is this the case? Any help would be appreciated

bta
  • 133
  • 3
amlearn369
  • 51
  • 1

1 Answers1

6

The claim (which I can't find anywhere in the answers to the linked question) is incorrect. A constant function can't be one-way. To see why, let's recall the definition of a one-way function.

A function $f : \{0,1\}^* \to \{0,1\}^*$ is one-way, if

  1. There exists a polynomial time algorithm $M_f$ such that $M_f(x) = f(x)$ for all $x\in\{0,1\}^*$.
  2. For every PPT algorithm $\mathcal{A}$ there exists a negligible function $\mathsf{negl}$ such that for all $\kappa\in\mathbb{N}$ it holds that $$\Pr[x\gets\{0,1\}^\kappa, y:=f(x)\;:\;f(\mathcal{A}(1^\kappa,y))=y ] \leq \mathsf{negl}(\kappa)$$

However, for any constant function is is easy to specify a PPT algorithm $\mathcal{A}$ for which $$\Pr_{x\gets\{0,1\}^\kappa}\bigl[f\bigl(\mathcal{A}(1^\kappa,f(x))\bigr)=f(x)\bigr] = 1$$ for all $\kappa\in\mathbb{N}$. E.g., we can define $\mathcal{A}$ as the algorithm that always outputs $1^\kappa$. I.e., for all $x\in\{0,1\}^\kappa$ we have $f\bigl(\mathcal{A}(1^\kappa,f(x))\bigr) = f(1^\kappa)$ and since the function $f$ is constant, it holds for all $x\in\{0,1\}^\kappa$ that $f(1^\kappa) = f(x)$. Thus $\mathcal{A}$ breaks the one-wayness of $f$ with probability $1$ and $f$ is not one-way.

kelalaka
  • 49,797
  • 12
  • 123
  • 211
Maeher
  • 7,185
  • 1
  • 36
  • 46