crypt-summary-english-version

advertisement
Modern Cryptology – Test formulae sheet
Based on a paper written by Guy Shaked in 2011. Translated to English by Dekel Santo in 2014.
DES Encryption
𝑅𝑖 = 𝐿𝑖−1 ⨁𝐹(𝑅𝑖−1 , 𝐾𝑖 ),
𝐿𝑖 = 𝑅𝑖−1
F-function: 𝑖𝑛𝑝𝑒𝑑 (32 𝑏𝑖𝑑𝑠) → 𝑆𝐸 (48 𝑏𝑖𝑑𝑠)β¨π‘ π‘’π‘π‘˜π‘’π‘¦ (48 𝑏𝑖𝑑𝑠) → 𝑆 − π‘π‘œπ‘₯𝑒𝑠 → 𝑃 → π‘œπ‘’π‘‘π‘π‘’π‘‘ (32 𝑏𝑖𝑑𝑠)
Complementary property: if 𝐢 = 𝐸𝐾 (𝑃), then 𝐢̅ = 𝐸𝐾̅ (𝑃̅).
Attack: Request pairs 𝐢1 = 𝐸𝐾 (𝑃), 𝐢2 = 𝐸𝐾 (𝑃̅), try non-complementary 𝐾 ′ values: If 𝐸𝐾′ (𝑃) = 𝐢1, then
possibly 𝐾 = 𝐾′, and if 𝐸𝐾′ (𝑃) = 𝐢2 then possibly 𝐾 = Μ…Μ…Μ…
𝐾′.
Block Ciphers – Modes of operation
-
ECB – Each block is encrypted separately - 𝐢𝑖 = 𝐸𝐾 (𝑀𝑖 ), 𝑀𝑖 = 𝐷𝐾 (𝐢𝑖 )
CBC – Before encryption, each block is XOR’d with the encryption of the previous block 𝐢𝑖 = 𝐸𝐾 (𝑀𝑖 ⨁𝐢𝑖−1 ), 𝑀𝑖 = 𝐷𝐾 (𝐢𝑖 )⨁𝐢𝑖−1
OFB – Compute a pseudo-random string that will be XOR’d to the plaintext 𝑉𝑖 = 𝐸𝐾 (𝑣𝑖−1 ), 𝐢𝑖 = 𝑀𝑖 ⨁𝑉𝑖 ,
𝑀𝑖 = 𝐢𝑖 ⨁𝑉𝑖
CFB – 𝐢𝑖 = 𝑀𝑖 ⨁𝐸𝐾 (𝐢𝑖−1 ), 𝑀𝑖 = 𝐢𝑖 ⨁𝐸𝐾 (𝐢𝑖−1 )
Perfect Cipher
A cipher will be called perfect if every 𝑀, 𝐢 hold 𝑝(𝑀|𝐢) = 𝑝(𝑀). Equivalent definitions:
∀𝑀, 𝐢: 𝑝(𝐢) = 𝑝(𝐢|𝑀)
∀𝑀, 𝐢: 𝑝(𝐢|𝑀) =
∑
(𝐾 |𝐸𝐾 (𝑀)
𝑝(𝐾)
= 𝑐)
Therefore, a cipher is perfect iff for all 𝐢 the above sum is independent of 𝑀. A perfect cipher always
holds |𝐾| ≥ |𝑀|.
Unicity distance
𝑁=
π‘˜π‘’π‘¦ π‘™π‘’π‘›π‘”π‘‘β„Ž 𝑖𝑛 𝑏𝑖𝑑𝑠
𝐻(𝐾)
=
𝐷
𝐻(𝐢) − 𝐻(𝑃)
The unicity distance is the length of 𝑀, 𝐢 in relation to 𝐾, that will allow certain identification of the key
𝐾 given 𝑀, 𝐢.
𝐻 is a measure of mean entropy in a representation of a letter. 𝐷 is a measure of representation
redundancy, and is defined as 𝐷 β‰œ 𝐻(𝐢) − 𝐻(𝑃). In English, 1.5 bits are needed for every letter,
therefore in ASCII representation for example - 𝐷𝐴𝑆𝐢𝐼𝐼 = 8 − 1.5.
Birthday paradox
In order to find collision with probability greater than half, in a function with range of size π‘š, it is
enough to draw 1.17√π‘š different inputs. (Also works when drawing from 2 different sets)
Groups
A group {𝐺,βˆ™} holds-
Closure - 𝛼, 𝛽 ∈ 𝐺 ⇒ 𝛼 βˆ™ 𝛽 ∈ 𝐺
Identity element - 𝑒 ∈ 𝐺 such that ∀𝛼 ∈ 𝐺, 𝑒 βˆ™ 𝛼 = 𝛼 βˆ™ 𝑒 = 𝛼
Inverse element - 𝛼 ∈ 𝐺 ⇒ 𝛼 −1 ∈ 𝐺, 𝛼𝛼 −1 = 𝛼 −1 𝛼 = 𝑒
Associativity – 𝛼, 𝛽, 𝛾 ∈ 𝐺 ⇒ 𝛼 βˆ™ (𝛽 βˆ™ 𝛾) = (𝛼 βˆ™ 𝛽) βˆ™ 𝛾
Properties:
𝐺 ′ ⊆ 𝐺 subgroup iff 𝐺 ′ ≠ ∅ (and then 𝑒 ∈ 𝐺′), and the closure property is held on 𝐺′. An element’s
order divides the group’s order. If π‘Ž 𝑠 = 𝑒 then π‘œπ‘Ÿπ‘‘π‘’π‘Ÿ(π‘Ž, 𝐺)|𝑠.
Euler Function
πœ‘(𝑛) = |℀𝑛∗ | = |{𝑖 ∈ ℀𝑛 | gcd(𝑖, 𝑛) = 1}|
𝑒
For 𝑛 = ∏𝑖 𝑝𝑖 𝑖 :
𝑒 −1
πœ‘(𝑛) = ∏ (𝑝𝑖 𝑖
(𝑝𝑖 − 1)) = 𝑛 βˆ™ ∏ (1 −
𝑖
𝑖
1
)
𝑝𝑖
𝑝, π‘ž primes, π‘Ž, 𝑏, 𝑛 integers. The following holdsπœ‘(𝑝) = 𝑝 − 1
πœ‘(π‘π‘Ž ) = (𝑝 − 1)π‘π‘Ž−1 = π‘π‘Ž − π‘π‘Ž−1
πœ‘(π‘π‘ž) = (𝑝 − 1)(π‘ž − 1)
gcd(π‘Ž, 𝑏) = 1 ⇒ πœ‘(π‘Žπ‘) = πœ‘(π‘Ž)πœ‘(𝑏)
∑ πœ‘(𝑑) = 𝑛
𝑑|𝑛
𝑝
π‘Ž ≡ π‘Ž (π‘šπ‘œπ‘‘ 𝑝) (Fermat’s little theorem)
gcd(π‘Ž, 𝑛) = 1 ⇒ π‘Žπœ‘(𝑛) ≡ 1 (π‘šπ‘œπ‘‘ 𝑛)
Chinese Remainder Theorem
β„€∗π‘π‘ž ≅ (β„€∗𝑝 × β„€∗π‘ž ) and the transition between the groups can be done easily. Alternatively: There exists a
homomorphism β„Ž: β„€∗π‘π‘ž → ℀𝑝∗ × β„€π‘ž∗ . The homomorphism is defined β„Ž(𝑒) = (𝑒(π‘šπ‘œπ‘‘ 𝑝), 𝑒(π‘šπ‘œπ‘‘ π‘ž)).
Algorithm (for the transition from the right hand side to the left). Calculate π‘Ž, 𝑏 such thatπ‘Ž ≡ 1 (π‘šπ‘œπ‘‘ 𝑝)
𝑏 ≡ 0 (π‘šπ‘œπ‘‘ 𝑝)
π‘Ž ≡ 0 (π‘šπ‘œπ‘‘ π‘ž)
𝑏 ≡ 1 (π‘šπ‘œπ‘‘ π‘ž)
By π‘Ž = π‘ž βˆ™ (π‘ž −1 (π‘šπ‘œπ‘‘ 𝑝)), 𝑏 = 𝑝 βˆ™ (𝑝−1 (π‘šπ‘œπ‘‘ π‘ž). Then (𝑠, 𝑑) → π‘Ž βˆ™ 𝑠 + 𝑏 βˆ™ 𝑑.
Groups of the form β„€∗𝒏
An element π‘Ž has an inverse in ℀𝑛∗ iff gcd(π‘Ž, 𝑛) = 1. π‘œπ‘Ÿπ‘‘π‘’π‘Ÿ(π‘Ž, β„€∗𝑛 )|πœ‘(𝑛), and if 𝑛 is prime, then
π‘œπ‘Ÿπ‘‘π‘’π‘Ÿ(π‘Ž, β„€∗𝑛 )|(𝑛 − 1).
When 𝑛 is prime and 𝑑|(𝑛 − 1), the number of elements of order 𝑑 is β„€∗𝑝 is πœ‘(𝑑). In particular, the
number of generators is πœ‘(πœ‘(𝑝)) = πœ‘(𝑝 − 1).
Wilson’s Theorem - 1 βˆ™ 2 βˆ™ 3 βˆ™ … βˆ™ (𝑝 − 1) ≡ −1 (π‘šπ‘œπ‘‘ 𝑝).
Quadratic residues (𝑝 ≠ 2)
There are
πœ‘(𝑝)
2
𝑝−1
2
=
quadratic residues in β„€∗𝑝 .
Euler’s Criterion - π‘Ž ∈ β„€∗𝑝 is a quadratic residue iff π‘Ž
𝑝−1
2
≡(𝑝) 1.
For 𝑛 = π‘π‘ž - if π‘Ž ∈ ℀𝑛∗ is a quadratic residue, then it has 4 square roots. Therefore – there are exactly
πœ‘(𝑛)
quadratic
4
residues in β„€∗𝑛 .
Calculating root modulo 𝒑
𝑝 = 4π‘˜ + 3 - √π‘Ž = π‘Ž
𝑝+1
4
𝑝 = 4π‘˜ + 1 – Probabilistic algorithm –
-
-
Randomly select 𝑏 which is a quadratic non-residue.
Initialize 0 → 𝑑, 2π‘˜ → 𝑖
While 𝑖 is even
o
𝑖
2
o
If π‘Žπ‘– 𝑏 𝑑 ≡ −1 then 𝑑 + 2π‘˜ → 𝑑
Return π‘Ž
𝑑
→ 𝑖, 2 → 𝑑
𝑖+1
2
𝑑
, 𝑏2 .
Legendre’s symbol
+1 π‘Ž 𝑖𝑠 π‘Ž π‘žπ‘’π‘Žπ‘‘π‘Ÿπ‘Žπ‘‘π‘–π‘ π‘Ÿπ‘’π‘ π‘–π‘‘π‘’π‘’ π‘šπ‘œπ‘‘ 𝑝
π‘Ž
(𝑝) β‰œ {
−1 π‘Ž 𝑖𝑠 π‘Ž π‘žπ‘’π‘Žπ‘‘π‘Ÿπ‘Žπ‘‘π‘–π‘ π‘›π‘œπ‘› π‘Ÿπ‘’π‘ π‘–π‘‘π‘’π‘’ π‘šπ‘œπ‘‘ 𝑝
π‘Ž
According to Euler - (𝑝) ≡ π‘Ž
1
𝑐2
𝑝−1
2
Every 𝑐 holds (𝑝) = ( 𝑝 ) = 1
(π‘šπ‘œπ‘‘ 𝑝)
−1
(𝑝)={
1 𝑝 = 4π‘˜ + 1
−1 𝑝 = 4π‘˜ + 3
𝑝2 −1
8
2
𝑝
( ) = (−1)
π‘Žπ‘
π‘Ž
𝑏
( 𝑝 ) = (𝑝) (𝑝)
𝑝−1π‘ž−1
2 2
𝑝
If 𝑝, π‘ž are odd primes - (π‘ž ) = (−1)
π‘ž
(𝑝)
Jacoby’s symbol
𝑛 = 𝑝1 βˆ™ 𝑝2 βˆ™βˆ™βˆ™ π‘π‘˜ odd. π‘Ž is coprime to 𝑛. Jacoby’s symbol is defined as –
π‘Ž
π‘Ž
π‘Ž
π‘Ž
( ) β‰œ ( ) ( ) βˆ™βˆ™βˆ™ ( )
𝑛
𝑝1 𝑝2
π‘π‘˜
π‘Ž
π‘Ž
π‘Ž is a quadratic residue modulo 𝑛 iff (𝑝 ) = 1 for every 𝑖. Therefore – if (𝑛) = −1 we could know for
𝑖
π‘Ž
certain that π‘Ž is a quadratic non-residue. However (𝑛) = 1 does not guarantee that π‘Ž is a quadratic
residue.
𝑐2
1
1 is a quadratic residue for all 𝑛. In particular, (𝑛) = ( 𝑛 ) = 1.
𝑛−1
2
−1
( 𝑛 ) = (−1)
𝑛2 −1
8
2
𝑛
( ) = (−1)
π‘Ž
)
π‘šπ‘›
(
π‘Žπ‘
π‘Ž
π‘š
π‘Ž
𝑛
= ( )( )
π‘Ž
𝑏
( 𝑛 ) = (𝑛) (𝑛)
𝑛
π‘š−1𝑛−1
2
2
If π‘š, 𝑛 are coprime and odd - (π‘š) = (−1)
π‘š
(𝑛)
An efficient search requires 𝑂(log 2 𝑛) modular operations.
Number Theory
π‘Ž, 𝑏 coprime ⇔ ∃π‘₯, 𝑦 | π‘Žπ‘₯ + 𝑏𝑦 = 1
π‘Ž, 𝑏 coprime and π‘Ž | 𝑏𝑐 ⇒ π‘Ž | 𝑐
π‘š|π‘Ž, π‘š|𝑏 ⇒ π‘š|(π›Όπ‘Ž + 𝛽𝑏) ∀𝛼, 𝛽 ∈ β„€
gcd(π‘Ž, 𝑏) = min{π‘Žπ‘₯ + 𝑏𝑦 > 0 | π‘₯, 𝑦 ∈ β„€}
π‘™π‘π‘š(π‘Ž, 𝑏) = min{𝑐 > 0| π‘Ž|𝑐, 𝑏|𝑐}
π‘š|π‘Ž, π‘š|𝑏 ⇒ π‘š|gcd(π‘Ž, 𝑏)
gcd(π‘šπ‘Ž, π‘šπ‘) = |π‘š| βˆ™ gcd(π‘Ž, 𝑏)
Euclidean Algorithm finds gcd, and can be used to find a modular inverse. Complexity 𝑂(log(𝑛)).
π‘Ž has an inverse modulo 𝑛 ⇔ gcd(π‘Ž, 𝑛) = 1.
RSA Encryption
𝑝, π‘ž large primes, 𝑛 = π‘π‘ž. 𝑒 coprime to πœ‘(𝑛), 𝑑 = 𝑒 −1 (π‘šπ‘œπ‘‘ πœ‘(𝑛)).
(𝑛, 𝑒) public key, 𝑑 secret.
Encryption 𝑐 ← 𝑀𝑒 (π‘šπ‘œπ‘‘ 𝑛). Decryption 𝑀 ← 𝐢 𝑑 (π‘šπ‘œπ‘‘ 𝑛).
Properties:
π‘š
Multiplication property - 𝐸(π‘š1 βˆ™ π‘š2 ) = 𝐸(π‘š1 ) βˆ™ 𝐸(π‘š2 ). Encryption preserves Jacoby’s symbol ( 𝑛 ) =
π‘šπ‘’
( 𝑛 ).
Hardcore bits – lsb, half
Non-trivial element root (𝛼 2 = 1, 𝛼 ≠ ±1) allows factorization.
Modular square calculation allows factorization:
if π‘Ž2 = 𝑏 2 , then gcd(π‘Ž − 𝑏, 𝑛) and
𝑛
gcd(π‘Ž−𝑏,𝑛)
are the prime factors.
RSA Signatures
-
Signing process - 𝑆 = 𝐷𝐴 (π‘š) = 𝑀𝑑𝐴
Verification process - 𝑀 =? 𝐸𝐴 (𝑆) = 𝑆 𝑒𝐴
Zero Knowledge Proofs
Perfect – Simulator output with identical distribution to a “real” output.
Computational – The distribution of the simulator output and the distribution of a real prover’s output
are (computationally) indistinguishable, i.e. there can be a negligible difference between them.
If bit-commitment is used in a ZK protocol, perfect binding must be assured because the prover is
computationally unlimited. Therefore the secrecy is computational, and the protocol will be
computational ZK rather than perfect.
Zero-knowledge Computationally: Graph 3-Colorability.
Differential Cryptanalysis
𝑛-round Characteristic is Ω = (Ω𝑃 , ΩΛ , Ω𝑇 ) such that:
-
Ω𝑃 – π‘š bits, input difference (before encryption)
Ω𝑇 – π‘š bits, output difference (after encryption)
ΩΛ = (Λ1 , Λ 2 , … Λ π‘› ) intermediate rounds. Each of them:
o
Λ π‘– = (Λ𝑖𝐼 , Λ𝑖𝑂 ) (round input and output,
π‘š
2
bits each)
And the following are held –
-
Λ1𝐼 – Right half of Ω𝑃
Λ2𝐼 - Λ1𝑂 ⨁(Left half of Ω𝑃 )
Λ𝑛𝐼 – Right half of ٠𝑇
Λ𝑛−1
- Λ𝑛𝑂 ⨁(Left half of Ω𝑇 )
𝐼
𝑖+1
For every 2 ≤ 𝑖 ≤ 𝑛 − 1, Λ𝑖𝑂 = πœ†π‘–−1
𝐼 β¨πœ†πΌ
Correct pair in relation to a characteristic Ω and a key 𝐾 is a pair of inputs, the difference of which is Ω𝑃
and all the differences in the intermediate rounds match the description in the characteristic.
Probability of a characteristic is the probability that a pair of inputs which matches Ω𝑃 is a correct pair
(in relation to all the keys).
Differential is a set of all the characteristics which have identical Ω𝑃 , Ω𝑇 and an equal number of rounds.
The probability of a differential is the sum of the characteristics’ probabilities.
The iterative characteristic Ω𝑃 = (19 60 00 00π‘₯ , 00 00 00 00), also written as Ω𝑃 = (πœ“, 0). A two1
round characteristic, with probability 234. Ω𝑇 = (0, πœ“) so that it can be composed on itself.
Concatenation of the characteristic to 16-17 rounds yields a characteristic with probability of 2−62 , 2−63
respectively.
Note : In order to get the same output of F, two inputs must be different in at least 3 S-boxes.
0R Attack requires 2 βˆ™ 𝑝−1 pairs of input (𝑝 – characteristic probability), from which 2 correct pairs will
remain.
Secret Sharing
Secret sharing scheme:
-
𝑛 parties, each receiving a share.
A cooperation of pre-defined groups allows to reconstruct the secret.
Any group that wasn’t pre-defined cannot gain any information on the secret.
(π’Œ, 𝒏)-Threshold Scheme – a group can reconstruct the secret only if its size is at least π‘˜.
Hash Function
-
Merkle-Damgård padding: Given a message 𝑀, 𝑀 is padded so that its length will be a multiply
of the block size. The message length is included in the padding.
Merkle-Damgård construction: β„Žπ‘– = 𝐻(β„Žπ‘–−1 , 𝑀𝑖 ), where β„Ž0 = 𝐼𝑉 and β„Ž(𝑀1 , … 𝑀𝑛 ) = β„Žπ‘› .
Mutual Commitment
Perfect binding: The committer sends π‘”π‘Ÿ π‘šπ‘œπ‘‘ 𝑝 (π‘Ÿ odd/even according to 𝑆). The committer cannot
cheat (reveal another value), but the receiver can calculate 𝑆.
Perfect commitment: sends 𝑔 𝑆 β„Žπ‘Ÿ π‘šπ‘œπ‘‘ 𝑝 (𝑔, β„Ž generators of a group of element of order π‘ž|𝑝 − 1). The
receiver cannot calculate 𝑆, but the committer can reveal different 𝑆, π‘Ÿ values.
Common coin (bit) toss: Each one commits on one bit and sends, afterwards the bits are revealed and
the coin will be 𝑏 = 𝑏𝐴 ⨁𝑏𝐡 .
1
𝑂𝑇: B learns a bit with probability 2, A doesn’t know whether B has learned the bit.
𝑂𝑇12 : B learns one of two secrets of his choice. A doesn’t know which secret B has learned.
Implementations: bit commitment, non-interactive zero-knowledge proofs.
Download