Encrypted random key generation | Coursera Community

# Encrypted random key generation

• 2 replies
• 71 views +1
• Newcomer
• 0 replies
hi,

i am looking for generating a random key as long as the length of the message and would like to encrypt the same with the plain text to produce cipher text. the random key has to be chosen purely at random each time when encryption is to be done. what sort of algorithmic approaches are available to prove the randomization? pl do help .

### 2 replies

Userlevel 7 +13
Hi @madhusri. I added some tags to your post in the hopes this will help community members find it. Are you still in search of suggestions?
Userlevel 4 +3
proving "randomness" is kinda tricky.

Here are two ways to measure randomness.

The first involves entropy and information theory. In this case, if we where to generate random binary strings of length 6 the argument is that 000111 is more 'random' than 000001. If you think about it this kind of makes sense; if a binary string seems to produce more 1's than 0's then if you should guess 1 all the time and on average you'd do better than 50%. Whereas if the string is an equal mix of zero's and ones you cannot predict better than 1/2.

With this in mind, your first measures of randomness could be to prove that all letters in alphabet 'A' follow a uniform distribution. And (2) check the strings entropy. the more the better.

Another definition of randomness is "algorithmic random". In a nutshell, a string's randomness is defined by the smallest algorithm capable of producing it. A truly random sequence will therefore require an algorithm as long as the string. Meanwhile a string such as 0101010101... scores very low on algorithmic randomness because the program that generates that sequence is very short:

code:
`#python bit = 0sequence = []while True:    sequence.append(bit)    bit ^= 1  # bitwise xor`