# Cryptography key size question ASCII characters

I need help wrapping my head around this notions on the key lengths and size.

Exercise: Key sizes Task 1: Key size What is the key size of key for sequences of 10 ASCII characters? What is the corresponding key length in bits? Task 2: Key complexity At least how many ASCII characters are required for a password with 128-bit key length What if only the printable characters of the ASCII character set are to be used.

Task 1 -> for me it's 10 ascii characters, 1 byte each char so 10Bytes. This means 80bits.

Task 2 -> here it's the difficult part, for me we have 128/8=16 chars But what about the only printable one? they are 95, so how can i calculate it? Because I think I shouldn't do 95/8 because we want the 128 bit key length.

Can anyone solve this exercise? Thanks in advance

• Welcome, but expect only hints for homework Q. There is not clear distinction between "keys size" and "key length". However if one tells there is, then they likely mean "effective key size in bit" when they say "key size", and that's clearly defined as $x$ such that there are $2^x$ possible keys with a distinguishable effect when used. So since there are not 256 distinct ASCII characters, the Q's 80-bit can't be a valid "effective key size in bit", even though it could be a "key length". Hint: If $2^x=y$, then $x=\log_2(y)=\ln(y)/\ln(2)$.
– fgrieu
Commented Jul 21 at 18:46
• @fgrieu thanks for helping. Ok, so: log 2 (95)≈6.57 Now, we need to find the minimum number of characters n such that: n×6.57≥128 n: n≥ 128/6.57 ≈19.48 Since the number of characters must be an integer: n≥20 Is it correct? Commented Jul 21 at 20:51
• Yes. Another, equivalent way to look at it is: $95^{20-1}<2^{128}\le95^{20}$. Update: but that's ignoring the "password" part of the problem statement. A memorable 20-ASCII printable characters password is far less secure than one generated at random.
– fgrieu
Commented Jul 21 at 21:51

I'm answering this because I have an immediate hate of the first question.

What is the key size of key for sequences of 10 ASCII characters?

Keys in modern cryptography do not consist of ASCII characters; they consist of bytes. This question is unclear as it doesn't specify which characters should be included in the password or passphrase.

The amount of entropy in a fully random password or passphrase would be $$n^{10}$$ where $$n$$ is the size of the alphabet, i.e. the characters allowed. $$n$$ would be 95 for all printable characters (or 94 if space is disallowed).

The size of the password would would be 10 characters of course (sheesh).

At least how many ASCII characters are required for a password with 128-bit key length What if only the printable characters of the ASCII character set are to be used.

If I were mad I would simply divide 128 bit by 7 or 8. But no, what's meant is that $$\log_2({128^x}) = 128$$ and then calculate the minimum $$x$$ to get to that value or over it. For printable it would be $$\log_2({95^x}) = 128$$ obviously.

Task 1 -> for me it's 10 ascii characters, 1 byte each char so 10Bytes. This means 80bits.

I would consider it half a point, but since ASCII characters only require 7 bits $$7 \times 10 = 70$$ bits would be a better answer.

I've given you enough of a hint on how to solve $$x$$ for printable ASCII I guess; it's one unknown variable in an equation after all. Just enter the TeX into WolframAlpha and it will try and determine $$x$$ for you.

• Please give the instructor a bit of a bashing because they are confusing keys and passwords. Learning how to do this kind of math should be possible without confusing keys and passphrases. Commented Jul 22 at 1:45