Let $H(h,k)$ be the expected entropy of some random oracle $X:\left\{0,1\right\}^h \to \left\{0,1\right\}^k$, where $h$ does not necessarily equal $k$.
- Then, is it true that $\lim\limits_{h\to\infty}H(h,k) = k$ ? (for constant $k$)
- If so, is the above still true if $h = 2k$? In other words, does $\lim\limits_{h\to\infty} h - H(2h,h) = 0$ ? (for common hash functions like SHA-256/512, the input block size is twice the bits of the output)
For #1, my hunch is that it is true simply by the Law of Large Numbers, where $X$ is more likely to become uniformly distributed in $\left\{0,1\right\}^k$ as $h\to\infty$.
For #2, I am not so sure. A uniform distribution in $\left\{0,1\right\}^k$ has variance $\sigma^2 \sim 2^{2k} = 2^h$, which may "cancel out" this effect of the Law of Large Numbers as $h\to\infty$.
*Edit -- to calculate the expected entropy, I followed fgrieu's approach from The effect of truncated hash on entropy, where fgrieu derived the expected entropy of a random $h=k$ oracle as $$H = h - \frac{1}{2^h}\sum_{j=1}^{2^h}n_jj\lg\left(j\right) \approx h - 0.8272453$$
However, for a more "general" random oracle (where possibly $h\ne k$), I obtained $$n_j = 2^k\binom{2^h}{j}\left(\frac{1}{2^k}\right)^j\left(1-\frac{1}{2^k}\right)^{2^h-j}$$ and so $$H = h - 2^{k-h}\sum_{j=1}^{2^h}\binom{2^h}{j}\left(\frac{1}{2^k}\right)^j\left(1-\frac{1}{2^k}\right)^{2^h-j}j\lg\left(j\right)$$ which does not seem to have a nice simple closed-form or approximation like in the $h = k$ case there.
*Edit #2 -- it seems Wolfram-Alpha also miscalculates the limits here. For example, in the simple case of a 1-bit random oracle $X:\{1,2,\ldots,n\}\to\{1,2\}$, the expected entropy would just be $$ H_n = -\frac{1}{2^n}\sum_{j=1}^{n-1}\binom{n}{j}\left[\left(\frac{j}{n}\right)\lg\left(\frac{j}{n}\right) + \left(1-\frac{j}{n}\right)\lg\left(1-\frac{j}{n}\right)\right]$$ (ignoring the two zero-entropy cases $j=0,n$, where $X$ either maps everything to $0$ or everything to $1$).
But, Wolfram-Alpha seems to suggest that $\lim\limits_{n\to\infty} H_n = 0$ (and even hangs when substituting $h=n$), when in fact actually $\lim\limits_{n\to\infty} H_n = 1$. This can be demonstrated by showing that $H_n$ is already bounded from below by a (much simpler) sum $$B_n = \frac{1}{2^n}\sum_{j=1}^{n-1}\binom{n}{j}\left[4\times\frac{j}{n}\left(1-\frac{j}{n}\right)\right] = 1 - \frac{1}{n}$$ such that $0 < B_n < H_n < 1$ for all $n > 1$, thus implying that $\lim\limits_{n\to\infty}H_n = 1$.
ent3
soon, as an upgrade of the venerableent
test program. It specifically targets DIY TRNG makers in the 25kB to 1MB sample size range. In addition to the 6 original tests, there’s some additional ones and all have accurate $p$ values. I hope you comment on it... $\endgroup$