cencryptioncryptographykeykey-generator

How to create a keystream generator in C for simple XOR cipher?


I am trying to create a keystream generator in C in order to encrypt some data with the generated key. This is for educational purposes.

In cryptography, a keystream is a stream of random or pseudorandom characters that are combined with a plaintext message to produce an encrypted message

There is a little or no information online that explains the internal functioning of a keystream generator. So, what is the proper way to create a keystream generator?


Solution

  • NIST has described a key stream generator based on AES (in counter/CTR) in NIST SP 800-38A.

    Writing good key stream generators is hard, and pure stream ciphers have fallen into disuse because they do not sufficiently protect message integrity.