tags: cryptography

A cipher used to encrypt streams of variable size, byte-by-byte encryption is one, larger unit sizes can be used, or even bit sized but usually it is one byte size. A pseudo-random number generator is used to generate random bytes from a seed, the output of the random generator is XORed with the plaintext, the same happens during decryption. One of the main characteristics that differ stream ciphers from block ciphers is that stream ciphers don’t depend on the plaintext before.

Truly random number generators need an entropy source to be able to generate truly random number.

What is a PRNG

What is meant by low correlation is the correlation between the numbers, life for example there is no linear relationship between the number, this makes it impossible to for crypt-analysts to understand a relation between the numbers. The possibility of predicting the next number depends on the correlation of the algorithm (an answer in a sheet problem).

PLS REMEMBER THE DIRECT THING DOES NOT DECREASE SECURITY

RC4 Algorithm

It is a stream cipher that is said that it’s period is .

During initialization vector S is initialized with the number 0 to 255, and K gets copied into T and is repeated as long as it fits there.

NOTE: Small RCL numbers cause shorter period of random numbers.

After that T is used to get the permutations of S by the following formula

The following snippet is then used to generate k which is XORed with the data to encrypt it. There is a picture in the reference in page 236 that explains what is happening.

Types of PRNG

Linear Congruent Generators

A really simple number generator that follows the following formula: here is the seed, , and are parameters that define what numbers will be generated. The algorithm is considered full period when it can generate numbers from 0 to , before repeating.

The following are used to test RNGs.

The only problems of this algorithm is that one piece of it is known it will help the crypt-analysts in discovering the sequence, because in reality there is nothing random at all. If he knew only 3 numbers of the sequence, the crypt-analyst can solve the algorithm for a, c and m. Look here for more.

Cyclic Encryption

Use an encryption algorithm that encrypts a number that comes from a counter, use the output and XOR it with the plain-text.

DES Output Feedback

The as normal output feedback mode but the encryption block is a DES. see ^13cbfd

ANSI X9.17 PRNG

The picture says enough. Initialized with random vector (the seed) and gets feed again in every iteration. A 64 bit date-time word is inputted every iteration the output R is then used to encrypt the plain-text.

Blum Blum Shub Generator

Choose two prime numbers that have a remainder 3 when divided by 4, i.e. Then take and choose a number that is relatively prime to . Then apply the following.

is the least significant bit of the number . This algorithm passes the next-bit test that states if there is no polynomial time algorithm that if inputted the first k bits can predict the probability of the next bit by a probability greater than half. If p and q are kept secret a possible attack is trying to brute-force all factors of n and get p and q.

Some times the exponent of s and can be a variable and increasing it causes the decrease of the period, only when w = 2 it produces full period