# What is SHA-512's input space, taking into account variable message size?

The SHA-512 hash function accepts any message from a single bit to $$2^{128}$$ bits. Because the function takes into account the message length, I can't just represent every message as a $$2^{128}$$-bit integer. I'm sure this is a very basic question, but my math background is limited so this isn't coming easily to me.

How do I calculate the number of distinct inputs?

$$1 + 2 + 4 + 8 + \dots + 2^{n-1} = 2^n-1$$
Note that the maximum message length is the same as the maximum value of a 128-bit integer, ie. $$2^{128} - 1$$, not $$2^{128}$$. That makes $$n-1 = 2^{128} - 1$$, so $$n = 2^{128}$$. That makes the total number of distinct inputs
$$2^{(2^{128}-1)} - 1$$
• It's tiny as far as large finite numbers go. It's less than $f_{3}(128)$ in the Wainer hierarchy, much smaller than something like $f_{ω_{1}}(3)$, for example. Still huge in the everyday sense though. Jul 18, 2019 at 17:30
• @SAIPeregrinus Which itself is much smaller than $\operatorname{Rayo}(10^{100})$... Jul 20, 2019 at 6:17