Professional Documents
Culture Documents
Code Information
Prepared by: Punit Sharma
1 PRG
• Python is used as the programming language for the assignment.
• For the first question where we have to build a Pseudo Random Generator, i have created a class
name PRG which has all the necessary functions.
• In order to manage easily the bit manipulation, the implementation of the algorithm is done on
strings.
• I used the modular exponentiation as one-way permutation and l(k) = k²-2k+1. Following con-
stants are considered in the code:
SEED-SIZE = 16
GENERATOR = 223
MODULUS = 36389
• The H function generates a one bit longer sequence from the initial seed. By calling the H function
l(k) times and taking just the last bit from each iteration, we have generated a sequence of l(k)
bits.
• The G function is the pseudo random generator. The only argument taken is the initial seed that
must be a binary string and longer no more than the value of the variable SEED-SIZE.
2 PRF
• The first input is called the key.
• The key is chosen randomly and then fixed, resulting in a single argument function.
• Assume that the functions are length preserving, meaning that the inputs, output and key are all
of the same size.
• Calling pseudo random generator continuosly on the basis of message length, taking key as initial
value.
3 CPA Secure
• Choosing a random number ctr. Passing them to PRF. PRF provides an output, to that output
we ex-ored it to the first block of message. Then passing ctr+1,ctr+2,...ctr+(n-1) to PRF.
1
Figure 1: Mathematical description
Figure 2:
2
5 CCA Secure
• Cipher text of the message and MAC is obtained.Encrypt and authentication is done in CCA
Secure.