Bit Security
在密碼學中,攻擊者未必想恢復全部秘密資訊,而可能只想知道其中某一個 bit。此時自然會問:從函數輸出中計算輸入的單一 bit,是否仍然是困難的。
例如對 RSA 函數 $x \mapsto y = x^e \pmod N$,攻擊者或許不在乎完整求出 $x$,而只想知道 $x \bmod 2$,也就是 $x$ 的奇偶性。若即使只是這一個 bit,也不能從函數輸出中被有效求得,我們便說這個函數具有 bit security。
Hard Predicate
- $B(x)$ is easy to compute when $x \in S$ is known, and
- $B(x)$ is hard to compute given only $f(x)$.
證明某個 predicate 為 hard predicate 的典型方法,是先假設存在一個 oracle,能夠在只給定 $f(x)$ 的情況下計算出 $B(x)$,再證明若有此 oracle,便可有效反轉 $f$。因此,若 $f$ 是 one-way function,則 $B(x)$ 不應能由 $f(x)$ 有效求得,也就是說,$B$ 是 $f$ 的 hard predicate。
此外,也可以定義 $k$-bit predicate 與 hard $k$-bit predicate;此時 $B$ 的值域不再是 ${0,1}$,而是長度為 $k$ 的 bit string。
Hard Predicate for Discrete Logarithm
Let $G$ denote a finite abelian group of prime order $q$, and let $g$ be a generator of $G$. Consider the following predicate:
\[B_2(x) = x \bmod 2\]In other words, $B_2(x)$ returns the least significant bit of the discrete logarithm $x$.
Suppose we are given $h=g^x$. We perform the following steps. First let $t=\frac{1}{2} \pmod q$. Then set $y=0$ and $z=1$, and repeat the following until $h=1$:
- $b = O(h,g)$.
- If $b=1$, then set $y=y+z$ and $h=h/g$.
- Set $h=h^t$ and $z=2z$.
DL 部分的關鍵在於:若已知目前離散對數的奇偶性,便可逐步恢復其值。
設 $h=g^x$。若 oracle 回傳 $x$ 為偶數,則可直接將指數除以 $2$;若 oracle 回傳 $x$ 為奇數,則先將 $x$ 減去 $1$ 使其成為偶數,再將其除以 $2$。由於群階 $q$ 是奇質數,$2$ 在模 $q$ 下可逆,因此上述操作在指數上是良定的。
重複此過程,便可依次確定 $x$ 的二進位表示,最終恢復完整的離散對數。由此可見,若能有效計算 $x \bmod 2$,便能進一步解出整個 discrete logarithm,因此 $B_2$ 是函數 $x \mapsto g^x$ 的 hard predicate。
| $h$ | $O(h,g)$ | $z$ | $y$ |
|---|---|---|---|
| 56 | 0 | 1 | 0 |
| 451 | 1 | 2 | 2 |
| 201 | 1 | 4 | 6 |
| 288 | 0 | 8 | 6 |
| 100 | 1 | 16 | 22 |
| 454 | 0 | 32 | 22 |
| 64 | 1 | 64 | 86 |
Hard Predicates for the RSA Problem
對 RSA 問題而言,給定 $c=m^e \pmod N$,可考慮以下三種 hard predicates:
- $B_1(m)=m \bmod 2$
- $B_h(m)=0$ if $m < N/2$ otherwise $B_h(m)=1$
- $B_k(m)=m \bmod 2^k$ where $k=O(\log\log N)$
若將這些 predicates 對應的 oracle 分別記為 $O_1(c,N)$、$O_h(c,N)$ 與 $O_k(c,N)$,則 $O_1$ 與 $O_h$ 之間存在密切關係。只要能計算其中之一,便可據此構造出另一者。
\[O_h(c,N)=O_1(c \cdot 2^e \bmod N, N)\] \[O_1(c,N)=O_h(c \cdot 2^{-e} \bmod N, N)\]因此,判斷明文的奇偶性與判斷明文是否落在區間 $[0, N/2)$ 內,在計算能力上是等價的。
若能判斷明文 $m$ 是否落在區間 $[0, N/2)$ 內,便可逐步縮小 $m$ 的可能範圍,進而恢復其值。其關鍵在於 RSA 函數滿足
\[(2m)^e \equiv 2^e m^e \pmod N\]因此從密文 $c=m^e \pmod N$ 出發,可以有效構造出對應於 $2m,4m,8m,\dots$ 的密文。每一步利用 oracle 判斷目前對應明文位於區間的前半或後半,便可將搜尋範圍縮小一半,這正是一種二分搜尋的過程。
- 計算 $b = O_h(y,N)$;
- 更新 $y = y \cdot 2^e \pmod N$;
- 令 $m = (h+l)/2$;
- 若 $b=1$,則設 $l=m$;否則設 $h=m$。
| $y$ | $O_h(y,N)$ | $l$ | $h$ |
|---|---|---|---|
| $3$ | 0 | 0 | 10403 |
| $3 \cdot 2^7$ | 1 | 0 | 5201.5 |
| $3 \cdot 4^7$ | 1 | 2600.75 | 5201.5 |
| $3 \cdot 8^7$ | 1 | 3901.125 | 5201.5 |
| $3 \cdot 16^7$ | 0 | 4551.3125 | 5201.5 |
| $3 \cdot 32^7$ | 0 | 4551.3125 | 4876.40625 |
| $3 \cdot 64^7$ | 1 | 4551.3125 | 4713.859375 |
| $3 \cdot 128^7$ | 0 | 4632.5859375 | 4713.859375 |
| $3 \cdot 256^7$ | 1 | 4632.5859375 | 4673.22265625 |
| $3 \cdot 512^7$ | 1 | 4652.904296875 | 4673.22265625 |
| $3 \cdot 1024^7$ | 1 | 4663.0634765625 | 4673.22265625 |
| $3 \cdot 2048^7$ | 1 | 4668.14306640625 | 4673.22265625 |
| $3 \cdot 4096^7$ | 1 | 4670.682861328125 | 4673.22265625 |
| $3 \cdot 8192^7$ | 0 | 4671.9527587890625 | 4673.22265625 |
References
- Nigel P. Smart, Cryptography: An Introduction (3rd ed.), Chapter 19. PDF