In this section we consider the problem
of generating a sequence of random numbers
on a computer.
Specifically, we desire an infinite sequence
of statistically independent random numbers
uniformly distributed between zero and one.
In practice,
because the sequence is generated algorithmically
using finite-precision arithmetic,
it is neither infinite nor truly random.
Instead, we say that an algorithm is ``good enough''
if the sequence it generates satisfies almost any
statistical test of randomness.
Such a sequence is said to be pseudorandom .
The most common algorithms for generating pseudorandom numbers
are based on the linear congruential
random number generator invented by Lehmer.
Given a positive integer m called the modulus
and an initial seed value ( ),
Lehmer's algorithm computes a sequence
of integers between 0 and m-1.
The elements of the sequence are given by
where a and c are carefully chosen integers
such that and .
For example, the parameters a=13, c=1, m=16 and
produce the sequence
The first m elements of this sequence are distinct
and appear to have been drawn at random from the set
.
However since the sequence is cyclic
with period m.
Notice that the elements of the sequence alternate between
odd and even integers.
This follows directly from Equation and the fact
that m=16 is a multiple of 2.
Similar patterns arise when we consider the elements
as binary numbers:
The least significant two bits are cyclic with period four
and the least significant three bits are cycle with period eight!
(These patterns arise because m=16 is also a multiple of 4 and 8).
The existence of such patterns make the sequence less random.
This suggests that the best choice for the modulus m is a prime number.
Not all parameter values result in a period of m.
For example, changing the multiplier a to 11 produces the sequence
the period of which is only m/2.
In general because each subsequent element of the sequence
is determined solely from its predecessor
and because there are m possible values,
the longest possible period is m.
Such a generator is called a full period generator.
In practice the increment c is often set to zero.
In this case, Equation becomes
This is called a multiplicative linear congruential
random number generator.
(For it is called a mixed linear congruential generator).
In order to prevent the sequence generated by Equation
from collapsing to zero,
the modulus m must be prime and cannot be zero.
For example, the parameters a=6, m=13 and
produce the sequence
Notice that the first 12 elements of the sequence are distinct.
Since a multiplicative congruential generator can never produce a zero,
the maximum possible period is m-1.
Therefore, this is a full period generator.
As the final step of the process,
the elements of the sequence are normalized
by division by the modulus:
In so doing, we obtain a sequence of random numbers
that fall between zero and one.
Specifically, a mixed congruential generator ( )
produces numbers in the interval [0,1),
whereas a multiplicative congruential generator (c=0)
produces numbers in the interval (0,1).
Rabu, 22 Mei 2013
Selasa, 07 Mei 2013
Encryption with DES
As mentioned earlier there are two main
types of cryptography in use today - symmetric or secret key
cryptography and asymmetric or public key cryptography. Symmetric key
cryptography is the oldest type whereas asymmetric cryptography is only
being used publicly since the late 1970’s1. Asymmetric cryptography was a
major milestone in the search for a perfect encryption scheme. Secret
key cryptography goes back to at least Egyptian times and is of concern
here. It involves the use of only one key which is used for both
encryption and decryption (hence the use of the term symmetric). Figure
2.1 depicts this idea. It is necessary for security purposes that the
secret key never be revealed
Figu 2.1 |
To accomplish encryption, most secret
key algorithms use two main techniques known as substitution and
permutation. Substitution is simply a mapping of one value to another
whereas permutation is a reordering of the bit positions for each of the
inputs. These techniques are used a number of times in iterations
called rounds. Generally, the more rounds there are, the more secure the
algorithm. A non-linearity is also introduced into the encryption so
that decryption will be computationally infeasible2 without the secret
key. This is achieved with the use of S-boxes which are basically
non-linear substitution tables where either the output is smaller than
the input or vice versa.
The DES algorithm
The main parts of the algorithm are as follows:
- Fractioning of the text into 64-bit (8 octet) blocks;
- Initial permutation of blocks;
- Breakdown of the blocks into two parts: left and right, named L and R;
- Permutation and substitution steps repeated 16 times (called rounds);
- Re-joining of the left and right parts then inverse initial permutation.
Permutation
In mathematical
and computer science field of cryptography,
a group of three numbers (x,y,z) is said to be a claw of two permutations f0
and f1 if
f0(x) = f1(y) = z
The terminology claw free was introduced by Goldwasser, Micali, and Rivest in their 1984 paper, "A Paradoxical Solution to the Signature Problem", where they showed that the existence of claw-free pairs of trapdoor permutations implies the existence of digital signature schemes secure against adaptive chosen-message attack. This construction was later superseded by the construction of digital signatures from any one-way trapdoor permutation. The existence of trapdoor permutations does not by itself imply claw-free permutations exist; however, it has been shown that claw-free permutations do exist if factoring is hard.
This permutation table shows, when reading the table from left to right then from top to bottom, that the 58th bit of the 64-bit block is in first position, the 50th in second position and so forth.
A pair
of permutations f0 and f1 are said to be claw-free if there is no efficient
algorithm for computing a claw.
The terminology claw free was introduced by Goldwasser, Micali, and Rivest in their 1984 paper, "A Paradoxical Solution to the Signature Problem", where they showed that the existence of claw-free pairs of trapdoor permutations implies the existence of digital signature schemes secure against adaptive chosen-message attack. This construction was later superseded by the construction of digital signatures from any one-way trapdoor permutation. The existence of trapdoor permutations does not by itself imply claw-free permutations exist; however, it has been shown that claw-free permutations do exist if factoring is hard.
The general notion of claw-free permutation (not necessarily
trapdoor) was further studied by Ivan Damgard
in his PhD thesis The Application of Claw Free Functions in Cryptography
(Aarhus University, 1988), where he showed how to construct Collision Resistant Hash Functions from
claw-free permutations.
The notion of clawfreeness is closely related to that of collision resistance
in hash functions. The distinction is that claw-free permutations are pairs
of functions in which it is hard to create a collision between them, while a
collision-resistant hash function is a single function in which it's hard to
find a collision, i.e. a function H is collision resistant if it's hard
to find a pair of distinct values x,y such that
H(x) = H(y).
In the hash function literature, this is commonly termed a hash collision.
A hash function where collisions are difficult to find is said to have collision resistance.
Initial permutation
Firstly, each bit of a block is subject to initial permutation, which can be represented by the following initial permutation (IP) table:
IP |
|
This permutation table shows, when reading the table from left to right then from top to bottom, that the 58th bit of the 64-bit block is in first position, the 50th in second position and so forth.
Langganan:
Postingan (Atom)