Download solutions for the assignments

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Birthday problem wikipedia , lookup

Inductive probability wikipedia , lookup

Infinite monkey theorem wikipedia , lookup

Transcript
1. For a 1-1 affine cipher to exist in any alphabet, each character must map to another character such
that no two characters may map onto the same character.
a. For an english alphabet of 26 letters, there are
unique 1-1 affine ciphers
b. For a Hirangana alphabet, there are
unique 1-1 affine ciphers
2. Hypothesis: Assume that B is the encryption of E since it is the most frequent. Numerically, this
is expressed as
We get two linear equations and two unknowns:
This system has a unique solution
,
, and is also valid since
, so
it is at least a legal key. It remains to compute the decryption function corresponding to the
determined key,
, and then decrypt the ciphertext to confirm the validity of
the key. The decryption function:
But we need to solve for
first…
Now we can verify if the decryption function is correct for
:
3. To prove an affine cipher has perfect secrecy, we would need to show that:
for all
and
If each key is used with equal probability, then the probability that a key is used for a given
transformation from plaintext to cipher text is:
Solving for the event that plaintext x is encrypted as cipher text y:
We would then need to compute the probability distribution on C with
Finally, using Bayes’ theorem, and plugging in for
and we should get:
4. The assumption
is required because no two distinctly different keys can map a plaintext
character to the same cipher text character. If two characters were mapped to the same cipher text
character, then decrypting the cipher text character would violate the invertible encryption
function that must be injective. Otherwise the encrypted information will be lost
5. This system violates the perfect secrecy theorem since the probability of each cipher text is not
uniformly distributed amongst the variables such that:
Instead, two examples are calculated to show this violation:
Perfect secrecy has been violated since
6. NO SOLUTION
.
End of Assignment 1
1.
on
We have to find the prime factors, p and q such that
. The values of
and
are these prime factorizations. To find the private key, d we need to use the Euclidean algorithm
with
:
2.
Syntax:
//when the current exponent bit is set.
//on each iteration of bit from right to left
// bit is not set
//square base mod 1234
// bit is not set
//
bit is not set
//
bit is set
//
bit is set
//
bit is not set
//
bit is set
//
bit is not set
//
bit is not set
//
bit is set
3.
Original RSA defines:

, and
 b is defined by
.
The only thing that differs with the modified RSA is the mod n value. Let a letter of cipher text be defined
by:
Then there exists an inverse function for a letter of plain text defined by:
Combining the two we get:
Since
If
then
where
, then
;
;
,
and
Then
, or in English, x is the decrypted plaint text of the encrypted x for
the first function, and y is the encryption of the decrypted cipher text of y for the second.
With our example we get:
Solving for a in original RSA:
Solving for a in modified RSA:
4.
Proof by Example:
Using the RSA values from Question #1:
Define the two plain text characters
and
as ‘D’ and ‘P’ respectively, or as
and
We will prove true for both sides of the equation of
Since
.
.
we have:
is true.
Bonus: For good measure, let us test the decryption method for
which is obvious that
We have already calculated
, and choose
and
. Decrypting this value we get:
This means we know the secret keys used in the decryption of the cipher text. Since the RSA cipher is
one-to-one, no two values can map back to the same pre-image. If they did, there would be no way to
decrypt the cipher text. Just to confirm, we solve for x:
is the correct pre-image of the cipher text of
, or that
.
5.
Euler’s Phi-Function
and
, is defined as the number of positive integers a such that
. Then, we have that
since n is prime. It follows that all integers less
than n are going to be relatively prime to n. If this property did not exist, n would not be prime and
Each of these integers
,
, and
6. Let the plain text be
for
The same products will exist for
. The elements of
and since
will have the relationship
, we have that
are invertible which means that
,
.
as bits [Image from p.97 of the text]
Since the same process is applied to
we have:
,
7.
If
is a collision resistant hash function then:
We have
where if
then
, and
. This hash
function takes the bit string which is double the input length of the first hash function, chops it up in half
so that it can be used by the first hash function.
shows how the two parts
of chopped up bit strings are fed into the first hash function, , and concatenated, resulting in a bit
string of length 2m. This resulting string is then used to feed again to finally give an m bit string.
Solving for
And finally, we get
that.
:
. Since
is clearly many applications of a hash function
End of Assignment 2
1a.
By definition, the Linear Congruential Generator is defined by:
We want to show that
Assume
is true
is true, then
where:
such that:
Which implies that it should hold true for
1b.
Plugging in
.
into the previous equation that was derived:
We get:
1c. The period of length t may never exceed n where
since:
created by the LCM, they each generate a sequence of m different
congruential generator cannot generate more than m numbers, since
and
’s. The linear
, and
. The order of a is the number of factors of the congruential generator. The
value of t may not exceed the number of factors because the generator would lack the prime factors it
would need to generate the pseudo-primes.
,
2.
Since
and
requires 16 bits to represent this number, then
. We can calculate the i-th number using the formula:
Using Modular Exponentiation, we can calculate for the 10,000th number:
Subbing in that result, we can raise
to that power and calculate using modular exponentiation again:
We have a total of
calculations which is less than the limit of
multiplications.
3.
A key for the affine cipher is represented by
where
where n is the size of
set of plain text and each key has equal probability of being used. The cipher text is equal probable of
size n characters.
denotes the uncertainty of knowing the key if the cipher text is known.
Since each of the keys and cipher texts have equal probability of use, they can be written as:
Then
4.
, and
,
5.
Primitive roots of
Alice’s public key
Alice computes:
Bob computes:
6.
The points on the curve are any values of x and y for which the equation
holds true. Using the elliptic curve equation,
we can calculate some points
that lie on the curve:
Quadratic residue:
x
0
1
2
3
4
5
6
8
5
3
8
4
no
no
yes
yes
no
yes
6
7
8
9
10
8
4
9
7
4
No
yes
Yes
No
Yes
=
. The next multiple would be
with the same
mathematical process applied on each round.
Repeating this, we get the following points:
which are two points on the curve defined by
.
7.
Sample output from a programming implementation of the Rho-P Algorithm:
:1
:2
:5
:26
:677
:14915
:10701
:4757
:14885
:3531
:10112
:13715
:8806
:11357
:11030
:17386
D:5
Two factors for 21115 are
and
D:5
D:41
A third factor can be figured out from this point by:
8.
.
If n is odd then
and
If n is not prime then
for some
If n is not a power of a prime then
Let
:
1.
2.
3. 15 is not prime
4.
D:5
15 is not a power of a prime,
and
where
.
End of Assignment 3