1.What is the stream cipher?
The basic principle of stream cipher is to perform bit-by-bit or character-by-character operations on the plaintext (message) data stream and the key stream to obtain the ciphertext data stream.
For example:
The message is 1011010, the key is 0101001. ( Unless otherwise specified, the ciphertext is equal to the XOR of the message and the key. )
Ciphertext=1011010 xor 0101001=1110011
2.One time pad
One time pad has some requirements.
1.The key stream must be truly random
2.The length of the key stream must be greater than or equal to the length of the plaintext data stream. (This is the perfect secrecy definition. In other words, if a system is security, its the length of key must be longer than or equal to the message.)
3.The key stream cannot be reused (even partially) .
4.The key stream must be absolutely secret.
3.Pseudo Random Generator and PRG Security
As can be seen from the point 2, keys are generally required to be completely random. For this requirement, we need a producer which can produce seemingly "completely random" bit stream.
Normally, we need an approach to test the quality of PRG. It also means the "Security" of PRG.
My understanding of PRG security is that we cannot distinguish the "pesudo random" and "truly random". For example, no matter what input I give to the system, its outputs are completely random. If its result show a pattern in centain input, we are easy to find the "pesudo random" system. The PRG Security exact definition is that the "pesudo random" and "truly random" are computationally indistinguished.
4.Semantic Security
Semantic Security has two requirments:
1. The ciphertext cannot disclose any content of the plaintext.
2. The nth-bit ciphertext cannot be inferred from any 'n-1'th-bit ciphertext.
Semantic security is a weaker but more practical security requirement than perfect secrecy, and can be used to build semantically secure stream ciphers, as well as other more complex cryptographic primitives.