1
$\begingroup$

I was new to cryptography. And I know that in the world of cryptography there are two types of Symmetric Algorithms:

  1. Stream Cipher (RC4, Salsa & Chacha)
  2. Block Cipher (DES, AES)

And when doing some research on their implementation, I only looked at file encryption & decryption software products that use the AES algorithm (Block Cipher in general). (i know that AES is secure)

Can anyone help me answer the question whether Stream Cipher can be used to encrypt files like: .txt .docx .exe .zip?

I know this is a stupid question. Please forgive me.

$\endgroup$
2
  • $\begingroup$ Both block and stream ciphers (and any cipher in general) can be used to encrypt data. And what do files contain? $\endgroup$
    – DannyNiu
    Mar 21, 2021 at 8:41
  • $\begingroup$ @DannyNiu The file contains binaries. And in any format: .jpg .png .txt .docx .exe .zip, etc. $\endgroup$
    – akez
    Mar 21, 2021 at 10:23

1 Answer 1

1
$\begingroup$

Yes, for sure.

Commonly block ciphers are used for disk encryption algorithms because disks (or partitions) have a particular size. So there is no place to store an IV or authentication tag. They are also optimized for local changes to occur w.r.t. confidentiality and locality of the change. Finally they have to operate for a specific sector size. A stream cipher would be less useful here.

However, the size files can generally be changed in both length and content pretty easily. This application level encryption has much more freedom, so any cipher can basically be used. You should however remember that stream ciphers often use XOR, which means that you may loose confidentiality if multiple versions of the same file are available to an attacker and the IV wasn't changed. In other words, you'd have to fully re-encrypt the file each time a change needs to be stored.

$\endgroup$

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.