0% found this document useful (0 votes)
4 views

A2_2020

The document outlines the requirements for Assignment 2 of CSCI361 at the University of Wollongong, focusing on public key cryptography and its applications. It includes six programming tasks, each with specific implementation guidelines, such as creating encryption schemes, prime number testing, hash function collision finding, and RSA signature implementation. Submission must be made via Moodle, with strict penalties for plagiarism and late submissions.

Uploaded by

jeremiahkanhs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

A2_2020

The document outlines the requirements for Assignment 2 of CSCI361 at the University of Wollongong, focusing on public key cryptography and its applications. It includes six programming tasks, each with specific implementation guidelines, such as creating encryption schemes, prime number testing, hash function collision finding, and RSA signature implementation. Submission must be made via Moodle, with strict penalties for plagiarism and late submissions.

Uploaded by

jeremiahkanhs
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

University of Wollongong

Singapore Institute of Management


School of Computing and Information Technology (SCIT)
Lecturers: Professor Willy Susilo and Mr. Japit Sionggo

CSCI361 - Session 1 2020

Assignment 2 - Programming Assignment (15 marks)


Due: 27 February 2020, 9pm Singapore time. Submission via Moodle only.
Aim: To gain a basic familiarity with public key cryptography and its applications.

Standard Requirements for Assignments


• Submission must be made via Moodle. No other submission method will attract any marks.

• Submission via email will result in getting ZERO.

• Follow the directions given by the tutor (Mr. Sionggo).

• At the top of your code, you will need to specify the version of the programming language that
you use.

• Students are to give batch / make files for compilation.

• Students are to place all compilation and instructions on how to run the program inside a
README.TXT file. The markers will refer to this file when marking.

• Submission filenames are to be the same as the ones given in the assignment specifications, do
not use your own filenames.

• Plaigarised assignments will receive 0 marks immediately.

• DO NOT post this assignment to any forum, or else you will receive 0 marks immediately.

• Penalty for the late assignment is 25% per day.

1
1 Task One. Implementation of Trapdoor Knapsack En-
cryption Scheme (2 marks)
In this section, you are to implement a trapdoor knapsack encryption scheme. When the program
is run, it first asks for the size of the super-increasing knapsack, then the user is asked to enter the
value of each ai in the private key. Then, the user is asked to enter a modulus, follows by a multiplier.
You will need to check whether condition of the multipllier is satisfied. Then, the public key will
be generated and shown. Now, a set of message is being asked, and the ciphertext will need to be
displayed. Finally, a ciphertext will need to be asked and the correct decryption of the ciphertext
will need to be displayed. Implement this part as knapsack.cpp or knapsack.java

2 Task Two. Lehman’s test (2 marks)


You are to implement lehman.cpp or lehman.java in this task, to implement the Lehman’s algorithm.
The input to this program is a number, and your program will need to determine whether that number
is a prime number or not. You need to display how many tests have been conducted and what are
the random numbers that have been used for testing.

3 Task Three. Collision Finding of Hash Functions (3 marks)


SHA-1 is a commonly used hash function. It produces 160-bit hash value. You can download the
source code for SHA-1 from the web, but you need to state where you get the original code from. As
an example, see this github: https://github.com/clibs/sha1
We learnt in the lecture that a good hash function should be collision-resistant, meaning that it
is difficult to find two messages, m and m’, where m 6= m0 , such that H(m) = H(m0 ). In this task,
we assume a simplified version of SHA-1, named SSHA-1, is used for hashing. SSHA-1 only outputs
the first 32 bits of SHA-1 when hashing a message.
Your task is to find a pair of integers (x, x0 ) such that x 6= x0 but the SSHA-1 hash values of the
following two messages are the same.
Mr. Don Lee owes [FIRSTNAME] x dollars
Mr. Don Lee owes [FIRSTNAME] x’ dollars
You should replace [FIRSTNAME] with your first name. Write a C++ or JAVA program to
accomplish the task. Your program should output the two messages, their hash values (should be
the same), and the number of trials your program has made before it finds the collision.

4 Task Four. Implementing Ring Signature of 2 users (2


marks)
In this task, you are to implement a ring signature for 2 users, as described in the lecture notes. The
input files are the following:

2
• publickey.txt

• message.txt

The file publickey.txt has four lines, which indicates: e1 , n1 , e2 , n2 from RSA algorithm. The mes-
sage.txt contains a string of characters, which needs to be signed. You need to implement two
programs: sign and verify. The sign program will sign the message (from message.txt) and read
the public keys from publickey.txt. It will ask for one input, which is user 1 or user 2, who is the
signer, and the program will ask for that user’s private key. Then, the sign program will output
signature.txt.
The verify program will take an input of publickey.txt, message.txt and signature.txt and it will
output True or False to show the verification of the ring signature.
The symmetric encryption should use the AES algorithm. You can import the AES algorithm
from the existing library or use any implementation of AES algorithm (with 10 rounds) to do this.

5 Task Five. RSA implementation (2 marks)


In this task, you are going to implement the RSA signature using C++ or Java. Below are components
that need to be implemented.
1. KeyGen: The RSA key generations function. (1 mark)
2. Sign: The RSA signing function. (0.5 mark)
3. Verify: The RSA verification function. (0.5 mark)
The key generation function (KeyGen) should take the bit-length (up to 32) of p and q as input,
and output the public key (N, e) and the corresponding private key (N, p, q, d) into two separate files
pk.txt and sk.txt respectively, where p, q are distinct primer numbers, N = p ∗ q (i.e., N is up to 64
bits), d ∗ e = 1mod((p − 1) ∗ (q − 1)).
The signing function (Sign) should take the private (secret) key from sk.txt and a message M (a
positive integer smaller than N) from a file mssg.txt as input, and output the corresponding signature
S = M d (mod N ) into another file sig.txt.
The verification function (Verify) should take the public key from pk.txt and a signature S (a
positive integer smaller than N) from sig.txt and the message M as input, and output (display) the
verification result “True” or “False” on the screen (terminal). When your program is executed, a
menu with these three functions should be displayed and a user can choose to invoke any of these
functions for multiple times.
Important: the key generation function should be probabilistic. That is, the output of the key
generation function should be different even if the same bit-length for p and q is chosen.

6 Task Five. Simplified Blockchain: Simulating Proof of


Work (4 marks)
In this assignment, your task is to write a simple program for simulating Proof-of-work. The as-
sumptions on the simulation program are as follows:

3
1. A blockchain node wants to compute a new block using proof-of-work.
2. SHA1 (160 bits output) is used for hash.
3. The program simulate the Proof-of-Work is described below.
The program for proof-of-work should perform the following:
1. The program takes at least two parameters as follows:
(a) The condition of the hash value of a new valid block (The number of leading zeros).
(b) The data newly added to the current block.
2. The program outputs a random nonce value for a new block and hashed value of the new block.
3. The program provides a function to validate the output. This function takes a random nonce
and the data as inputs and outputs the hashed value to check the validity of the new block.
For example, your program can be executed with the following command
./hashcash limit 4 data new_ledger.txt
In the above:
1. limit parameter takes the limit of hashed value of a new block. For example, a blockchain
system only accepts a block if the first four digits of hashed value of a new valid block are 0s.
2. data parameter takes the name of a file. It contains data newly added to current block. It
should be noted that the file (new ledger.txt) must include all necessary information to create
a new block. For example, it should include at least transaction records and the hashed value
of the last valid block. Note that transaction records can be artificial. This assignment does
not mark the validity of the transaction records.
3. The output of the program must be human readable such as hexadecimal format. Also, it
satisfies the condition specified when the program executed.

Submission
You need to submit one ZIP file and upload it to Moodle. In this ZIP file, you need to create six
subdirectories, in which each subdirectory will have the answer to each task. For each programming
task, write a README file that explains the compiler setting. Ideally, you should make a Makefile
for each of the tasks.
DISCLAIMER: This assignment contains an intellectual property that is owned by the University
of Wollongong. Please do not use it without the permission from the University of Wollongong. If
you have any questions, please contact the author on [email protected].
DISCLAIMER: By submitting your assignment, you DECLARE that the assignment is your
own work and you did not obtain it from any third party or even purchase it from someone else or
ask someone else to do it for you. If you violate this rule, then you may end up failing the subject
entirely.

You might also like