At EasyTechJunkie, we're committed to delivering accurate, trustworthy information. Our expert-authored content is rigorously fact-checked and sourced from credible authorities. Discover how we uphold the highest standards in providing you with reliable knowledge.

Learn more...

What is a Stream Cipher?

A stream cipher is a method of encryption where a cryptographic key and algorithm create a stream of bits that scramble individual message bits or characters one at a time. This process ensures data security during transmission, making it a favorite in real-time communication. Curious about how stream ciphers keep your digital conversations private? Dive deeper to unravel their cryptographic magic.
S.A. Keel
S.A. Keel

A stream cipher is a type of algorithm used in data encryption where the source that needs to be encrypted is processed against a key sequence that appears random. This type of cipher is somewhat flexible in the sense that it may vary the encryption as the text is being processed. They are also sometimes referred to as a state cipher because encryption also depends on the current state of the operation. In contrast to block ciphers, which work on chunks of data 64 bits at a time, a stream cipher can operate on a single bit. For this reason, a stream can be processed at high speeds with very little processing power.

The first stream cipher was devised by Gilbert Vernam in 1917. Vernam later also helped create a cipher known as the one-time pad, which is a form of stream cipher that uses a one-time key to encrypt the data. In a one-time pad, the key generated is the same length as the data that needs to be encrypted, is completely random, and is never used again anywhere else, hence the name.

A key sequence is part of a stream cipher.
A key sequence is part of a stream cipher.

When processed against the data to be encrypted, typically referred to as plaintext, the resultant ciphertext is impossible to decrypt without the key. The one-time pad is difficult to deal with in most scenarios, and is, therefore, only used for very exclusive situations. Still, a stream cipher is usually considered useful, so the keys were shortened and made pseudorandom, meaning they are statistically random but in reality are not.

Stream cipher has the ability to encrypt on the fly. In this way, it is even easy for simple stream ciphers to be performed by people on pen and paper, whereas a block cipher typically requires the use of a computer to process. The plaintext flows through the encryption process along with the keystream, the pseudorandom sequence that makes up the key, where it is converted and comes out the other end as ciphertext.

Usually, this encryption happens via an exclusive-or (XOR) operation on the individual bits as they pass through the cipher. A simple XOR cipher uses a type of logical disjunction as its basis, which essentially says that the result can be true if either operand is true, but not both. For example, if a bit moving through the encryption process is a zero or a one, and the paired keystream bit doesn't match, the resultant output is a one. If the bit and paired keystream bit do match, where both are a one, or both are a zero, the result is a zero. The encrypted stream of ones and zeros are then decrypted on the other end of the transmission using the same keystream to convert the bits back into their original plaintext.

There are two types of stream cipher. Using a synchronous method, the keystream is created separate from the plaintext or the ciphertext and then merged to provide the encryption or decryption. With this method, both the sending and receiving ends of the transmission must remain synchronized where they are operating on the same key and the same position in the key. Should a problem occur, the decryption either needs to start over, or there may be flags placed intermittently throughout the ciphertext that indicate new starting points. A self-synchronizing cipher, on the other hand, will update the keystream based on some number of previous digits in the ciphertext.

One of the most frequently used stream cipher, called RC4, was created by RSA Data Security®. It is licensed for and used in a number of software products, as well as the secure socket layer (SSL) protocol used in secure Internet communications and the wired equivalent privacy (WEP) encryption used with wireless devices. Another often used cipher is known as ORYX, which has found use in cellular telephone data transmissions that need to be encrypted. IBM® has also developed an stream encryption method known as SEAL, which has found use in hard disk encryption.

You might also Like

Discussion Comments


@Markerrag -- Encryption was a major problem because of the issues you mentioned before the advent of computers. Thanks to computers, it is much easier to encrypt and decode things.

Ever heard banks brag about 128-bit encryption to keep your data safe when you are banking online? That 128-bit method is just a very complex form of encryption that can be encoded and decoded quickly by a computer that has the proper information.

Of course, things are not foolproof. It is still very possible for someone to grab information not meant for them and decrypt it. Still, it is harder to break codes than it was before computers become dominant.


This whole article points out the problem with encryption in general. In the example where you have the "one key, one time" system, dealing with that can be difficult. How do you get the key to the person who is supposed to decrypt it?

Otherwise, it can be far too easy for someone to intercept a key and encrypt messages all day long. We saw the Allies do just that during World War II and that kept them ahead of the Axis powers (of course, the Axis may have intercepted some Allied keys but we don't hear much about that).

Post your comments
Forgot password?
    • A key sequence is part of a stream cipher.
      By: Cousin_Avi
      A key sequence is part of a stream cipher.