2
$\begingroup$

I need to know how can I determine the key size in bits knowing the ciphertext and the encryption algorithm used?

For example suppose the plaintext was "ABC" and after the encryption it became "DEF" so the key size in bits = 1 bit because each letter is shifted only by 1 to its next character? Or I am wrong?

Please explain it in more details and thanks in advance and sorry for the inconvenience.

$\endgroup$

2 Answers 2

2
$\begingroup$

I need to know how can I determine the key size in bits knowing the ciphertext and the encryption algorithm used?

That depends on what you mean exactly by the term encryption algorithm used.

The full description of an encryption scheme usually consists of three parts. For example if AES-128-GCM was used to encrypt, that means that the block cipher AES was used in GCM mode using a 128 bit key. If your scheme is named liked this, than you are presented with the key length directly (Note that there are different schemes as well (like stream ciphers), which won't follow this naming scheme).

If the key size is not included in the name, there is usually no way to deduce it from the ciphertext. This is due to the fact that most encryption algorithms can be used with different key sizes (128, 192 and 256 bits in the case of AES) while keeping other parameters, visible to the outside world (input and output length), the same.

For example suppose the plaintext was "ABC" and after the encryption it became "DEF" so the key size in bits = 1 bit because each letter is shifted only by 1 to its next character? Or I am wrong?

In the case of the classic Caesar cipher that you are using here, the key is an integer value between zero and 26 (of 52, or 62, if you allow for more characters) specifying the shift. So, depending on the size of your alphabet (the number of input / output characters that will be encrypted), the key's size will be between 5 and 7 bits.

$\endgroup$
2
  • $\begingroup$ This answer would be enhanced if it is explained that the key size is independent on the block size, and that the plaintext/ciphertext combination may not expose the algorithm nor the block size for most modes of operation. Or I could just leave this comment here :) $\endgroup$
    – Maarten Bodewes
    Nov 26, 2017 at 14:35
  • $\begingroup$ @Marteen Bodewes: I opt for the latter ;-) $\endgroup$
    – mat
    Nov 27, 2017 at 18:33
0
$\begingroup$

Generally speaking, you are able to determine the key size only if the underlying encryption algorithm uses the one fixed key length (e. g. DES - 56-bits; AES uses 3 different key lengths 128-, 192- and 256-bits), or - e. g. as in the case of OTP - the key length is derived from the length of the plain text.

$\endgroup$
1
  • $\begingroup$ Sometimes 3DES is also incorrectly called DES with a 112/128 or 168/192 bit key size (the higher values are the key sizes including parity). $\endgroup$
    – Maarten Bodewes
    Nov 27, 2017 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.