We know that in stream cipher algorithms plain text and generated key are Xored byte by byte. Generated key depends on how much plain text there is and on that basis key will generate and plain text is encrypted. So my doubt is I am using the latest stream cipher algorithm that is Rabbit and encrypting plain text using the Rabbit stream cipher so in that Rabbit's input key is 128-bit and after all operations output will be a 128-bit key that will Xored with Plain text and give cipher text. As here output is fixed 128-bit so if our data is more than 128-bit then how it will encrypt data? Do we have to do padding with our plain text to make it a multiple of 128-bits?
1$\begingroup$ What makes you think that the output of Rabbit is limited to128 bits? It generates 128 bits per iteration; however you're not limited to doing only 1 iteration. $\endgroup$– ponchoApr 24, 2015 at 15:16
$\begingroup$ Ya, that is right.but in Rabbit algorithm after all iteration it generates 128-bits so if we give them as a key then it will generate again 128-bits but if we give less than 128-bits data then it will not encrypted and showing error that data is less than 128-bits. So for that how will data encrypt? And you are saying that we are not limited to one iteration so it means whatever output will come from Rabbit that will feed as key again as produce again 128-bit key and that will feed as key and produce again 128-bit key like that are you saying? $\endgroup$– Smit shahApr 27, 2015 at 5:21
The stream cipher generates 128 key stream bits per iteration. Usually these bits are buffered internally. When the encryption or decryption (identical operation, encryption = decryption) takes place then the bits are taken out of the buffer and the plaintext at the same location is xorred with it. When the keystream buffer is exhausted the next iteration takes place, making another 16 bytes of key stream available to the user.
Some implementations do wait for the full block to become available. This should however be the exception rather than the rule. The last (possibly incomplete) block just takes as many bits out of the buffer as necessary. The other bits are simply discarded.
Note that this is entirely the same scheme as used by e.g. AES in counter mode. One possible performance enhancement is to enlarge the buffer and generate more 128 bit blocks of key stream in one go. This may have benefits if the generation of larger amounts of keystream is less CPU or CPU-cache intensive.
$\begingroup$ "taken out of the buffer" usually just means that the data at the current offset is put into a variable and that the offset is advanced, of course. The next iteration usually is only computed when required (as no more keystream may be required when the end of the plaintext / ciphertext stream is reached). $\endgroup$– Maarten Bodewes ♦Apr 28, 2015 at 18:15
$\begingroup$ So it means in Rabbit stream cipher algorithm as we are giving manually 16 byte key so after all internal operation of rabbit like key extraction, next state function, g-function then giving 16-byte pseudorandom key that will Xored with 16-byte plain text so for more than 16-byte plain text that pseudorandom key will give as input to key and generate again pseudorandom key and used for Xoring with plain text? $\endgroup$ Apr 29, 2015 at 5:51
$\begingroup$ Although I don't exactly know the specifics of the Rabbit stream cipher, that's the general idea yes. $\endgroup$– Maarten Bodewes ♦Apr 29, 2015 at 16:14