CIS 5371 Cryptography
3b. Pseudorandomness
Based on: Jonathan Katz and Yehuda Lindell Introduction to Modern Cryptography
1
Pseudorandomness
An introduction
β’ A distribution D is pseudorandom if no PPT
distinguisher can detect if it a string sampled
according to D or chosen uniformly at random.
β’ This is formalized by requiring that every PPT
algorithm outputs 1 with almost the same
probability when given a truly random string
as when given a pseudorandom string.
2
Pseudorandomness
An introduction
β’ A pseudorandom generator is a
deterministic algorithm that given a short
truly random seed of length n will stretch
it to into a longer string of length π(π)
that is pseudorandom.
3
Existence of pseudorandom
generators
β’ We cannot prove that pseudorandom
generators exist!
β’ We believe that such generators can be
constructed from one-way functions.
β’ There are some long-standing problems
that have no efficient solution and it is
believed that they are unsolvable in
polynomial time.
4
Pseudorandom generators
informal definition
β’ A distribution D is pseudorandom if no PPT
distinguisher can detect if it is given a string
sampled according to D or a string chosen
uniformly at random.
β’ This can be formalized by requiring that a PPT
distinguisher D outputs 1 with almost the
same probability when given a truly random
string and when given a pseudorandom string.
5
Pseudorandomness
Definition
Let π(β) be a polynomial and πΊ a deterministic
polynomial-time algorithm that for any π and any
input π π {0,1}π will output string of length π(π).
πΊ is a pseudorandom generator if:
β’ π π >π
β’ β PPT distinguishers π·, β π negl function with:
| Pr π· π = 1 β Pr π· πΊ π = 1 β€ negl(n)
where π is uniform random string of length π π , π ππ
is uniform random of length π and the probabilities
are taken over the coins used by π· and the choices
of π, π .
6
Stream Ciphers
A stream cipher is a deterministic algorithm
(Init, GetBits) where,
β’
β’
Init takes as input a seed π and an optional
initialization vector πΌπ and outputs a state π π‘0 .
GetBits takes as input π π‘π and outputs a bit π¦
and state π π‘π+1
7
Algorithm 3.16
Construct πΊπ from (Init, GetBits)
Input: Seed π and optional πΌπ.
Output: π¦1 , β¦ , π¦π
π π‘0 β Init(π , πΌπ)
for π = 1 to π:
π¦π , π π‘π β GetBits π π‘πβ1
return π¦1 , β¦ , π¦π
8
A secure fixed length
encryption scheme
π
ππ ππ’ππππππππ
πππππππ‘ππ
πππ
ππππππ‘ππ₯π‘
πππ
πππβπππ‘ππ₯π‘
9
A secure fixed length encryption
Protocol Ξ
Let πΊ be a pseudorandom generator with expansion
factor π. Define a private-key encryption scheme
for messages of length π as follows
β’ Gen: on input 1π choose π ο¬ {0,1}π uniformly at
random and output π as key.
β’ Enc: on input a key π ο {0,1}π and a message
πο{0,1}π(π) output the ciphertext
π βG π ο
π.
β’ Dec: on input a key π ο {0,1}π and a ciphertext
cο{0,1}π(π) output the plaintext
π βG π ο
π.
10
A secure fixed length encryption
Theorem
If πΊ be a pseudorandom generator then
protocol ο is a fixed-length private-key
encryption scheme that has
indistinguishable encryptions in the
presence of an eavesdropper.
11
A secure fixed length encryption
Reduction
Adversary Aβ
(Distinguisher D)
Adversary A (Protocol ο)
1π
π€
choose a random bit π
compute ππ : = w ο
ππ
1 if π β² = π
0 if π β² οΉ π
π0 , π1
ππ
Suppose that A
succeeds with
probability π(π)
πβ²
12
A secure fixed length encryption
Proof
β’
when π€ is uniform random we have
Pr π· π€ = 1 = Pr
β’
PrivK eav (π΄, ο
π =1 =
1
.
2
when π€ = πΊ(π) we have
Pr π· πΊ π
= 1 = Pr PrivK eav (π΄, ο π = 1
Since πΊ is a pseudorandom generator
| Pr π· π€ = 1 - Pr π· πΊ π
= 1 | β€ negl
Therefore
|
1
2
β Pr PrivK eav π΄, ο π = 1 | β€ negl.
13
Stream ciphers
β’ We can easily modify the earlier construction
for the encryption scheme ο for variable
output length PRG.
β’ In this case,
β’ π β G π, 1 π ο
π .
β’ π β G π, 1|π| ο
π .
14
Discussion
β’ We use the term
β’ stream cipher
for the PR stream generator,
β’ not the encryption algorithm.
β’ There are a number of practical
constructions of stream ciphers that are
extraordinarily fast, such as the stream
cipher RC4.
15
Discussion
β’ The WEP encryption protocol for 802.11
used RC4 and was broken.
β’ But since then it is fixed---and the standard
updated.
β’ If RC4 has to be used the first 1024 bits or
so should be discarded.
16
Discussion
β’ From a security point of view it is
advocated to use block cipher constructions
for constructing secure encryption
schemes.
β’ This disadvantage is that this approach is
less efficient when compared to using a
dedicated stream cipher.
17
Multi-message eavesdropping
mult
experiment PrivK
(π΄,ο)(π)
1. The adversary π΄ is given input 1π and outputs a pair
of vectors of messages π10 , β¦ , π0π‘ and π11 , β¦ , π1π‘
witβ |π0π = |π1π for all π.
2. A key π is generated runnng πΊππ 1π and a random bit
π ο¬ 0,1 is chosen. For all π the ciphertext πππ ο¬ Enππ πππ
is computed and the vector of ciphertexts ππ1 , β¦ , πππ‘
is given to π΄.
3. .π΄ outputs a bit π β² .
4. The output of the experiment iπ 1 if π = π β² and 0 otherwise.
18
Definition
A private-key encryption scheme ο=(Gen,Enc,Dec)
that has indistinguishable multiple encryptions in
the presence of an eavesdropper satisfies:
ο’ PPT Adversary π΄, ο€ a negligible function negl:
Pr[PrivK
mult
(π΄, ο) π = 1] β€
1
2
+ negl π ,
where the probability is taken over the random
coins of π΄, and the experiment.
19
Indistinguishable single encryptions vs
indistinguishable multi encryptions
β’ The secure fixed length encryption Protocol Ξ
presented earlier is deterministic and cannot
be used as a construction for a
indistinguishable multi encryptions.
β’ To see why use the experiment PrivK mult for
the pair of vector messages (0π , 0π ) and
0π , 1π .
20
Secure multiple encryptions using a
stream-cipher mode of operation
β’ Synchronized mode
β’ Communicating parties use a different
part of the stream cipher output to
encrypt a message.
πΈπππ π β ο‘πΊβ π , 1|π| ο
πο±
β’ Useful for parties communicating in the
same session.
β’ Communicating parties must maintain
state between encryptions.
21
Secure multiple encryptions
stream-cipher mode of operation
Unsynchronized mode
ο§ Encryptions are carried out independently
of one another.
ο§ Communicating parties are not required to
maintain state between encryptions.
ο§ πΈπππ π β ο‘πΌπ, πΊβ π , πΌπ, 1|π| ο
πο±
where the initial vector πΌπ ο¬ {0,1}π is
chosen at random.
22
Security against ChosenPlaintext Attack (CPA)
ο§ We now consider a more powerful adversary
that is active.
ο§ The adversary can ask for the encryptions of
some specific plaintext messages, as well as
eavesdrop.
23
The CPA indistinguishability
experiment PrivK cpa (π΄,ο)(π)
1.
A key π is generated runnng Gen 1π .
2.
The adversary π΄ is given input 1π and oracle access to Enππ β ,
and outputs a pair of messages π0 , π1 of equal length.
3. A random bit π ο¬ 0,1 is chosen and a ciphertext
c ο¬ Enππ ππ is computed and given to π΄.
4. Adversary π΄ continues to have oracle access to Enππ β , and
outputs a bit π β² .
5. The output of the experiment iπ 1 if π = π β² and 0 otherwise.
24
Indistinguishable encryptions under CPA
Definition
A private-key encryption scheme ο = Gen, Enc, Dec
has indistinguishable encryptions under CPA if
β PPT adversaries π΄, β a negl function such that,
Pr[PrivKcpa
π΄, ο
π = 1] β€
1
2
+ negl π ,
where the probability is taken over the coins of A
and those of the experiment.
25
CPA security for multiple encryptions
ο§ As for single encryption, extend the experiment
to PrivK cpa in which the adversary outputs a
pair of vectors of plaintext.
ο§ Any private-key encryption scheme that has
indistinguishable encryptions under CPA also
has indistinguishable multiple encryptions
under CPA
26
© Copyright 2026 Paperzz