Assignment 1/CSEN_1001_InClass_Assignment_1_31718.pdf
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network Security Course)
Dr. Amr El Mougy
Reham Ayman
Abdelrahman Osama
Hacking Assignment 1 : Break Vigenère Ciphe
Discussion 08/02/ XXXXXXXXXX/02/2020 Task Grade 5%
1 Introduction
In this task you’re required to implement an algorithm to
eak Vigenère Cipher. This
can be done by following the Kasiski method explained in the lecture. The challenge in
automating it appears in having a way to determine the repetitions in the given Ciphertext
in order to guess the length of the key. Instead of following Kasiski method, we will
implement a different algorithm that won’t be as efficient as Kasiski method for long
cipher texts. The algorithm requires calculating a value called Index of Coincidence, that
indicate roughly the probability of two randomly selected letters being equal. You can
ead more about the Index of Coincidence in the following links:
https:
pages.mtu.edu/~shene/NSF-4/Tutorial/VIG/Vig-IOC-Len.html
2 Details
You are given a a starter python file containing the base implementation of the task. To
compute the key length, you will apply the concept of the Index of Coincidence, you can
start by dividing the Ciphertext into various cosets. And then calculating the average
Index of Coincidence for this possible division of cosets. You will then have to check the
average Index of Coincidence per key length and determine the most probable key length
y getting the one with the highest IC.
IC =
1
N(N − 1)
26∑
n=1
Fi(Fi − 1)
You are also provided with a set of test cases S0, S1 and S2 in order to check you
implementation once you are done.
You will find the source code on the MET website; ”VignereCrackerStarter.py”
3 Submission
You will be required to submit your file at the end of the tutorial slot. Upload the file to the
MET website in the corespondent submission link for your tutorial group. The python file
should be named as [ID] [TutoiralNumber] [Task Number] (e.g. [37 − 1111] [T01] [Task1]
).
In case there was a problem in the submission through the MET website, then send
an email to your TA with the title same as the name of the python file.
https:
pages.mtu.edu/~shene/NSF-4/Tutorial/VIG/Vig-IOC-Len.html
Introduction
Details
Submission
Assignment 2/In-classAssginment 2.1_31956.pdf
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network Security Course)
Dr. Amr El Mougy
Reham Ayman
Abdelrahman Osama
Hacking Assignment 2 : Break Simple RSA Schemes
Discussion 01/03/2020 Task Grade 5%
1 Introduction
In this task you’re required to implement an algorithm to
eak Simple RSA Schemes.
You are given PublicKey(e,n) and required to
eak the PrivateKey(d,n).
This can be done by following the steps:
1. Get the prime factors of n using the Sieve of Eratosthenes algorithm.
2. Once you have obtained the two prime factors p & q, you can then use the extended
Euclidean Algorithm to find the private key d using Φ(n) and the public key e.
3. After finding the private key, you can simply follow the decryption equation to get
the decrypted value:
M = Cd mod n
2 Details
You are given a starter code for this assignment containing the base implementation of
the task in Python. You will find the starter code for this assignment uploaded on the
MET website.
You are required to implement an algorithm that given the values; n, e and C en-
crypted using RSA, returns the both the private key d and the decrypted message
M.
To compute the prime factors of n, you will apply the Sieve of Eratosthenes algorithm to
get all the prime numbers till n. Once you get all the prime numbers till n, you can start
to check whether n is divisible by any two of the prime numbers. Once you find p & q;
two prime factors of n, you can calculate Euler’s Totient, Φ(n).
Once you acquire Φ(n), you can use it alongside e to calculate the private key d. This
can be done by using the Extended Euclidean Algorithm.
Once you have found the private key d, you can use it along with n to decrypt the
provided cipher by following the equation:
M = Cd mod n
You are also provided with a set of test cases within the source code file in order to
check your implementation once you are done. The tests should get both the co
ect d
and the co
ect decrypted message.
3 Submission
You will be required to submit your source code file by maximum one week from the
tutorial slot (e.g. if your tutorial slot is on Sunday, your deadline is the following Sa-
turday at 23:59) . Upload the source code file to the MET website in the corespon-
dent submission link for your tutorial group. The source code file should be named as
[ID] [TutoiralNumber] [Task Number] (e.g. [37 − 1111] [T01] [Task2] ).
In case there was a problem in the submission through the MET website, then send
an email to your TA with the title same as the name of the .java or .py file.
Page 2
Introduction
Details
Submission
Assignment 2/RSA_StarterCode_31955.pydef factorizeN(n):
p ,q = 0, 0
# you can change the initial values depending on your implementation
# Your Implementation Here
return p, q
def findD(n, e):
d = 0
# Your Implementation Here
return d
def decrypt(n, d, c):
m = 0
# Your Implementation Here
return m
if __name__ == "__main__":
d = findD(143, 11)
print("The PrivateKey d is: ", d)
print("The decrypted message is: ", decrypt(143, d, 106))
d1 = findD(91, 5)
print("The PrivateKey d is: ", d1)
print("The decrypted message is: ", decrypt(91, d1, 9))
d2 = findD(391, 15)
print("The PrivateKey d is: ", d2)
print("The decrypted message is: ", decrypt(391, d2, 364))
This is the most important/Project Description Updated_32482.pdf
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network Security Course)
Dr. Amr El Mougy
Reham Ayman
Abdelrahman Osama
Project Description
Deadline: 11:59pm Saturday 30 of May
Guidelines
This project should be done individually or in team of two. You can share ideas, consult the TA,
and search online. However, all work done in this project must be done individually or by all team
members.
The main aim of this project is to test your knowledge of the security concepts taught in this course.
Teams have to implement the Extra Required Deliverables for Teams in addition to the General
Deliverables.
All external assets used from the internet must be credited and commented in your project.
Any plagiarism detected will be penalized with a zero.
You are free to use any programming language.
Submission
❖ Final submission due to Saturday, May 30th, 2020 via MET Website.
❖ Submit a .Zip file containing your project. The Zip file naming format should be the following [ID]
[TutoiralNumber] (e.g. [ XXXXXXXXXX] [T01]
❖ In case there was a problem in the submission through the MET website, then send an email to your
TA with the title same as the name of the Zip file.
❖ If you are working in a team, include a Readme file containing the team members’ names,
IDs and Tutorial number.
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network Security Course)
Dr. Amr El Mougy
Reham Ayman
Abdelrahman Osama
Description
What is the main Idea?
In this project, we will design a cryptocu
ency similar to ScroogeCoin. A network of 100 users
will simulate the transaction processes. Initially each user will have 10 ScroogCoins. As long as
the system is running, a random transaction with random amount (within the range of amount the
user has) will be created from User A to User B. The transaction is signed by the private-key of the
sender. Scrooge get notified by every transaction. Scrooge verifies the signature before
accumulating the transaction. Once Scrooge accumulates 10 transaction, he can form a block and
attach it to the blockchain. You are allowed to use predefined hash and digital signature
li
aries. Mention which li
aries you used.
General Deliverables
❖ A designated entity “Scrooge” publishes an append-only ledger that contains
all the history of transactions.
❖ The ledger is a blockchain, where each block contains transactions, its ID,
the hash of the block, and a hash pointer to the previous block. The final hash
pointer is signed by Scrooge.
❖ A simulation of the network, with multiple users and the randomized process
of making a transaction, making each transaction reach an a
itrary user.
❖ The design and implementation of the ledger based on the concept of the
lockchain (hash linked list).
❖ Upon detecting any transaction, scrooge verifies it by making sure the coin
eally belongs to the owner and it has not been spent before.
❖ If verified, Scrooge adds the transaction to the blockchain. Double spending
can only happen before the transaction is published.
❖ For digital signature, use any of the technique described throughout the
course.
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network Security Course)
Dr. Amr El Mougy
Reham Ayman
Abdelrahman Osama
Extra Required Deliverables (for Teams)
❖ Implement Merkel Tree for the blockchain you create. The Merkel Tree
should reflect the change in the blockchain when adding a new block to the
lockchain.
❖ Transaction verification using Merkel Tree to make sure that the coins are
not spent before by the same user.
Output Format
❖ Print initially the public key and the amount of coins for each user.
❖ Scoorge should print the block under construction for each new transaction
added (include the transaction details).
❖ Print the blockchain after a new block is appended.
❖ Terminate the code using the key ‘Space’.
❖ Save all the printed data to a text file upon termination.
German University in Cairo
Faculty of MET (CSEN 1001 Computer and Network