# How can the key size be calculated [closed]

If the decrypting key is 448, then what is the key size? Suppose I am encrypting a plain text with a key by choosing some random numbers between 0 to 1000 then how I can calculate the key size?

-

## closed as unclear what you're asking by DrLecter, Ricky Demer, e-sushi, archie, GillesMay 12 '14 at 10:05

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

"If the decrypting key" for what "is 448"? $\;$ –  Ricky Demer May 12 '14 at 6:51
I find the question answerable, even if there are several possible answers, starting with ≈9.967 bit (key size as entropy), 10 bit (bit size of fixed-size bitstring coding all possible keys), and marginally 9 bit (number of bits in actual key), or anything above that (name your definition of key size tied to a particular encoding). –  fgrieu May 12 '14 at 11:43

by choosing some random numbers between 0 to 1000
(where numbers is understood as meaning integers), then there are $1001$ equaly probable keys. Hence the key size (or key entropy) is $\log_2(1001)=\log(1001)/\log(2)\approx9.967\text{ bit}$, and the representation of the key as a bitstring must be $10\text{ bit}$ at least (obtained by rounding up).
The actual value ($448$) of the key is only relevant to check that $0\le448\le1000$.
@TruthSerum: when keys are non-negative integers coded in binary, the size of the bitstring coding the key is $\lceil\log_2(m)\rceil$ where $m$ is the number of possible keys (with $m=n+1$ if $n$ is the maximum key); that matches your $1+\lfloor\log_2(n)\rfloor$. We should plug $m=1001$ into that (giving 10 bit), not $m=448$ (giving 9 bit) which would yield the bit size of the number coding a particular value of the key, which I think is less relevant. –  fgrieu May 12 '14 at 11:13