Block or Stream Encryption?

735 views Asked by At

I want to know if data stored in encrypted form is encrypted by block-cipher or a stream-cipher?

I have encrypted data, how do I check that it comes from a block or a stream cipher?

1

There are 1 answers

6
loopbackbee On

With only the encrypted data, there's no way to tell for sure, but a good indicator is to check the data length.

All of the common modern block ciphers (AES, Blowfish, DES, Serpent, Twofish) have block sizes of either 64 or 128 bits (8 and 16 bytes, respectively). Thus, if the encrypted data length in bytes is a multiple of 8, it's likely to be a block cipher (you have 1 in 8 probability of being wrong). if It's not a multiple of 8, you can be sure it's not a block cipher in common block modes (at most, it's a block cipher trying to emulate a stream cipher, such as in CFB mode).

Don't forget to exclude any potential file/stream headers, IVs, etc. Of course, if you do have a header, you might want to check there first to detect what cipher it's using...