CNS - Unit 2
CNS - Unit 2
CNS - Unit 2
ALGEBRAIC STRUCTURES
MODULAR ARITHMETIC:
Several important cryptosystems make use of modular arithmetic. This is when the
answer to a calculation is always in the range 0 – m where m is the modulus. To calculate the
value of n mod m, you take away as many multiples of m as possible until you are left with an
answer between 0 and m.
If n is a negative number then you add as many multiples of m as necessary to get an
answer in the range 0 – m.
Examples
17 mod 5 = 2 7 mod 11 = 7
20 mod 3 = 2 11 mod 11 = 0
-3 mod 11 = 8 -1 mod 11 = 10
25 mod 5 = 0 -11 mod 11 = 0
Two numbers a and b are said to be “congruent modulo n” if
(a mod n) = (b mod n) a ≡ b(mod n)
The difference between a and b will be a multiple of n
So a-b = kn for some value of k
E.g: 4 9 1419 -1 -6 mod 5
73 4(mod 23); 21 -9(mod 10)
If a 0 (mod n), then n|a.
EUCLIDEAN ALGORITHM:
• an efficient way to find the GCD(a,b)
• uses theorem that:
– GCD(a,b) = GCD(b, a mod b)
• Euclidean Algorithm to compute GCD(a,b) is:
Euclid(a,b)
if (b=0) then return a;
else return Euclid(b, a mod b);
Closure:
For all a, b in G, the result of the operation, a • b, is also in G.
Associativity
For all a, b and c in G, (a • b) • c = a • (b • c).
Identity element
There exists an element e in G, such that for every element a in G, the
equation e • a = a • e = a holds. Such an element is unique , and thus one speaks of the identity
element.
Inverse element
For each a in G, there exists an element a−1 such that
a • a −1= a−1 • a = e, where e is the identity element.
• The result of an operation may depend on the order of the operands.
• The result of combining element a with element b need not yield the same result as
combining element b with element a; the equation
a•b=b•a
may not always be true.
• Groups for which the commutativity equation a • b = b • a always holds are called
abelian groups
CYCLIC GROUP:
• A cyclic group or monogenous group is a group that is generated by a single element.
• It consists of a set of elements with a single invertible associative operation, and it
contains an element g such that every other element of the group may be obtained by
repeatedly applying the group operation or its inverse to g.
• Each element can be written as a power of g in multiplicative notation, or as a multiple
of g in additive notation. This element g is called a generator of the group.
• define exponentiation as repeated application of operator
• example: a3 = a.a.a
• and let identity be: e=a0
Cryptography & Network Security Page 4
• a group is cyclic if every element is a power of some fixed element
• ie b = ak for some a and every b in group
• a is said to be a generator of the group
RING {R, +, X}:
• A set equipped with two binary operations that generalize the arithmetic
operations of addition and multiplication.
• Through this generalization, theorems from arithmetic are extended to non-numerical
objects such as polynomials, series, matrices and functions.
• a set of “numbers” with two operations (addition and multiplication) which form an
abelian group with addition operation and multiplication:
• has closure if a and b € R, then ab € R
• is associative a(bc)=(ab)c for all a,b,c € R
• distributive over addition: a(b+c) = ab + ac
• if multiplication operation is commutative, it forms a commutative ring ab=ba
• if multiplication operation has an identity and no zero divisors, it forms an integral
domain
• Multiplicative identity : a.1 =1.a = a
• No zero divisor: a,b € R and ab=0, then either a=0/b=0
A ring is a set R equipped with binary operations + and · satisfying the following three sets of
axioms, called the ring axioms
1. R is an abelian group under addition, meaning that
– (a + b) + c = a + (b + c) for all a, b, c in R (+ is associative).
– a + b = b + a for all a, b in R (+ is commutative).
– There is an element 0 in R such that a + 0 = a for all a in R (0 is the additive
identity).
– For each a in R there exists −a in R such that a + (−a) = 0 (−a is the additive
inverse of a).
2. R is a monoid under multiplication, meaning that:
– (a ⋅ b) ⋅ c = a ⋅ (b ⋅ c)
for all a, b, c in R (⋅ is associative).
– There is an element 1 in R such that a ⋅ 1 = a and 1⋅ a = a
for all a in R (1 is the multiplicative identity).
3. Multiplication is distributive with respect to addition:
– a ⋅ (b + c) = (a ⋅ b) + (a ⋅ c)
for all a, b, c in R (left distributivity).
– (b + c) ⋅ a = (b ⋅ a) + (c ⋅ a)
for all a, b, c in R (right distributivity).
FIELD:
A field is a set F that is a commutative group with respect to two compatible
operations, addition and multiplication (the latter excluding zero), with "compatible" being
Cryptography & Network Security Page 5
formalized by distributivity, and the limitation that the additive and the multiplicative identities
are distinct (0 ≠ 1).
The most common way to formalize this is by defining a field as a set together with
two operations, usually called addition and multiplication, and denoted by + and ·, respectively,
such that the following axioms hold.
• Closure of F under addition and multiplication
For all a, b in F both a + b and a · b are in F
• Associativity of addition and multiplication
For all a, b, and c in F, the following equalities hold:
a + (b + c) = (a + b) + c
a · (b · c) = (a · b) · c.
• Commutativity of addition and multiplication
For all a and b in F, the following equalities hold:
a+b=b+a
a · b = b · a.
• Existence of additive and multiplicative identity elements
– There exists an element of F, called the additive identity element and
denoted by 0, such that
for all a in F, a + 0 = a.
– Likewise, there is an element, called the multiplicative identity element
and denoted by 1, such that
for all a in F, a · 1 = a.
To exclude the trivial ring, the additive identity and the multiplicative identity are
required to be distinct.
• Existence of additive inverses and multiplicative inverses
– For every a in F, there exists an element −a in F, such that
a + (−a) = 0.
– For any a in F other than 0, there exists an element a−1 in F, such that
a · a−1 = 1.
The elements a + (−b) and a · b −1 are also denoted a − b and a/b, respectively. In other
words, subtraction and division operations exist.
• Distributivity of multiplication over addition
– For all a, b and c in F, the following equality holds:
a · (b + c) = (a · b) + (a · c).
The bit by bit addition modulo 2 (or exclusive OR) of the E-box output and 48 bit subkey Ki.
Substitution Boxes S
have eight S-boxes which map 6 to 4 bits
each S-box is actually 4 little 4 bit boxes
outer bits 1 & 6 (row bits) select one rows
inner bits 2-5 (col bits) are substituted
result is 8 lots of 4 bits, or 32 bits
row selection depends on both data & key
feature known as autoclaving (autokeying)
Example: For input 011001
The row is 01(row 1) & column is 1100(col 12),The value in row 1, col 12 is 9
So the output is 1001.
STRENGH OF DES
With a key length of 56 bits, there are possible keys, which is approximately 7.2 * 10 ^ 6
keys.
Brute force attack becomes impractical in DES
cryptanalysis is possible by exploiting the characteristics of the DES algorithm.
The focus of concern has been on the eight substitution tables, or S-boxes, that are used
in each iteration.
LINEAR CRYPTANALYSIS:
another recent development
also a statistical method
must be iterated over rounds, with decreasing probabilities
2. Cost:
NIST intends AES to be practical in a wide range of applications. Accordingly, AES
must have high computational efficiency, so as to be usable in high-speed applications,
such as broadband links.
3.Algorithm and implementation characteristics:
This category includes a variety of considerations, including flexibility; suitability for a
variety of hardware and software implementations; and simplicity, which will make an
analysis of security more straightforward
Mix Columns
each column is processed separately
each byte is replaced by a value dependent on all 4 bytes in the column
effectively a matrix multiplication in GF(28) using prime poly m(x) =x8+x4+x3+x+1
RC4 ALGORITHM
RC4 is a stream cipher designed in 1987 by Ron Rivest for RSA Security.It is a variable
key size stream cipher with byte-oriented operations.
The algorithm is based on the use of a random permutation.
A variable-length key of from 1 to 256 bytes (8 to 2048 bits) is used to initialize a 256-
byte state vector S,with elements .
At all times, contains a permutation of all 8-bit numbers from 0 through 255. For
encryption and decryption, a byte is generated from S by selecting one of the 255 entries
in a systematic fashion.
As each value of is generated,the entries in S are once again permuted.
Initialization of S
To begin,the entries of are set equal to the values from 0 through 255 in ascending
order; that is, .
A temporary vector, T, is also created.If the length of the key is 256 bytes,then is
transferred to T.
Otherwise, for a key of length keylen bytes, the first keylen elements of T are
copied from K, and then K is repeated as many times as necessary to fill out
T.These preliminary operations can be summarized as
/* Initialization */
for i = 0 to 255 do S[i] = i; T[i] = K[i mod keylen];
Next we use T to produce the initial permutation of S.
/* Initial Permutation of S */
j = 0;
for i = 0 to 255 do
j = (j + S[i] + T[i]) mod 256;
Swap (S[i], S[j]);
Because the only operation on S is a swap, the only effect is a permutation. S still
contains all the numbers from 0 through 255.
Stream Generation
/* Stream Generation */
i, j = 0;
while (true)
i = (i + 1) mod 256;
j = (j + S[i]) mod 256;
KEY DISTRIBUTION
A typical stream cipher encrypts plaintext one byte at a time, although a stream cipher
may be designed to operate on one bit at a time or on units larger than a byte at a time. In
this structure,a key is input to a pseudorandom bit generator that produces a stream of 8 -
bit numbers that are apparently random.
The output of the generator, called a keystream, is combined one byte at a time with the
plaintext stream using the bitwise exclusive-OR (XOR) operation.
For example,if the next byte generated by the generator is 01101100 and the next
plaintext byte is 11001100, then the resulting ciphertext byte is
11001100 plaintext 01101100 key stream 10100000 ciphertext