COMP4337代写、代写Python/C++程序

COMP4337/9337 Securing Fixed and Wireless Network
Lab 1: Introduction to Basic Cryptographic Mechanisms
Due: M18A Lab - Monday 27th February 2023 11.59PM AEDT
W10A, W10B, W12A, W12B Labs – Wednesday 1st March 2023 11.59PM AEDT
Objectives
This lab is designed to help the students to:
learn the basics of cryptography for hiding secret information from non-trusted peers,
implement DES algorithm using Python or C, and
compare the performance of DES, AES, RSA, HMAC, and SHA-1 algorithms.
Lab Overview
The notion of cryptography consists of hiding secret information from non-trusted peers by
mangling messages into unintelligible text that only trusted peers can rearrange. In this lab, we
will use and compare three different techniques commonly employed to hide or encrypt
information: secret key cryptography (DES, AES), public key cryptography (RSA) and
message digests (SHA-1).
We also give a group of files as a reference on how to use certain built-in functions that we
will mention in this handout and that you can use in your implementations. These files are just
skeletons that you should modify to obtain the expected results. Included in the compressed
file is also a test case for your `DES-CBC` implementation (test.txt and test.des) and a
file with general descriptions of some built-in functions. Please refer to the skeletoncode
folder provided by your tutors.
Assessment and Marking
The submission link and the deadline will be available on Moodle. The marks will be made
available within 2 weeks of the submission date. The details of the marks are as follows:
Total mark for Lab 1 is 100. This lab combined with marks for other labs will be scaled
to 20 out of 100. The weight for this Lab is 0.3/1.
o Lab Performance (20),
o Report (40)
o Code (40)
Students who do not attend the lab will lose ALL 100 marks. Please discuss with the
lab tutors if there is a valid reason for not attending.
Note: Lab performance involves tutor asking question, feedback, and comments about
the activity while the lab is in progress. Hence, if a group is found to be cheating or
submitting a work that does not match what the tutor observes of the team performance,
then NO MARK will be awarded for that group.
The standard late penalty introduced under UNSW new assessment implementation
procedure will be applied for this course.
o 5% per day,
o for all assessments where a penalty applies,

2 of 5

o capped at five days (120 hours) from the assessment deadline, after which a
student cannot submit an assessment, and
o no permitted variation.
Submission
Please follow these instructions to prepare a submission for this lab:
1. You are given the option to do this lab either individually or in a pair. If you opt to do
in a pair, both team members will get equal marks.
2. Create a folder named Lab_1__. containing two subdirectories:
code/and report.
3. In code/:
For Python, include a copy of tempdes.py file. Name your file
_.des.py, where zid_1 and zid_2 are the zids of group
members. For example: z1234567_z7654321.des.py.
For C, include a copy of tempdes.c file. Name your file
_.des.c, where zid_1 and zid_2 are the zids of group
members. For example: z1234567_z7654321.des.c.
For students who do not have a strong preference and an experience in using C, we
recommend using Python.
4. In report/, upload a written report with the following information:
On the first page, include the name of the group, student names and ZIDs clearly.
Python or C code implemented.
Graphs showing:
o DES encryption/decryption time,
o AES encryption/decryption time,
o RSA encryption/decryption time,
o SHA-1 digest generation times, and
o HMAC signature generation times.
Note: In each of these graphs, the X-axis should plot the file sizes in units of bytes,
and the Y-axis should plot time measurements in units of microseconds (μs).
Answer the following questions:
o Compare DES and AES. Explain your observations.
o Compare DES and RSA. Explain your observations.
o Compare DES and SHA-1. Explain your observations.
o Compare HMAC and SHA-1. Explain your observations.
o Compare RSA encryption and decryption time. Can you explain your
observations?
5. Compress Lab_1__ folder and its content into a .zip file and
upload that file on Teams using the designated link. Only .zip file format is allowed.
Part A: DES encryption and decryption
In this part of the lab, we will be coding a tool to encrypt and decrypt files using DES in Cipher
Block Chaining (CBC) mode. tempdes.py or tempdec.c (for C programmers) is a skeleton

3 of 5

file that encrypts/decrypts a fixed 64-bit block. In this lab, you will extend the skeleton code to
take an arbitrarily sized input file and encrypt/decrypt it, by implementing the Cipher Block
Chaining DES mode of operation. You must implement the CBC mode. You may use the built-
in functions in tempdes.py or tempdec.c. You can find information about DES-CBC in
textbooks and online.
You may want to check your work against the input file test.txt. If you have implemented
the algorithm correctly and followed the instructions below you should get the output in
mytest.des. Check the output against test.des provided to see if it matches. You can find
these files in skeletoncode/.
Technical Requirements
Use the built-in functions that appear in tempdes.py or tempdes.c, depending on
your chosen language.
For C code, use lcrypto library to compile the source code, for example:
$ gcc tempdes.c -o tempdes -lcrypto
where, tempdes.c and tempdes are your source and executable, respectively.
Your result should take the following arguments:
For Python:
$ python tempdes.py iv key inputfile outputfile
For C:
$ ./tempdes iv key inputfile outputfile
The parameters description is as follows:
o iv: the actual IV to use, represented as a string comprised only of hexadecimal
digits.
o key: the actual key to use, represented as a string comprised only of
hexadecimal digits.
o inputfile: input file name.
o outputfile: output file name.
Example command to run the resulting code:
For Python:
$ python3 tempdes.py fecdba9876543210 0123456789abcdef
test.txt mytest.des
For C:
$ ./tempdes fecdba9876543210 0123456789abcdef test.txt
mytest.des
Please note that to get the sample output files you need to use the key and IV given
in the README file.
If any of the arguments is invalid, your code should return an error message to the user.
Be sure to consider the case when the keys are invalid.

4 of 5

Part B: Performance measures for various algorithms
The final part of this lab consists of measuring the time taken by DES, AES, PRESENT, RSA,
HMAC and SHA-1 algorithms to process files of different sizes. Please follow the following
steps:
1. Generate text files with the following sizes:
For DES, AES, PRESENT, HMAC, and SHA-1 (in bytes):
16, 64, 512, 4096, 32768, 262144, 2047152
For RSA (in bytes):
2, 4, 8, 16, 32, 64
2. Encrypt and decrypt all the files using the DES function that you wrote. Measure the
time it takes to encrypt and decrypt each of the files. To do this, you might want to use
the Python/C timing functions. Add these timing functions to your specific
implementation.
3. Repeat the above but instead of DES use AES.
4. Measure the time for RSA encryption and decryption for the file sizes listed in 1. To
do this, make appropriate changes to the file temprsa.py (or temprsa.c). This
skeleton code shows how to use built-in RSA encryption and decryption functions, but
you will need to augment it to allow for reading from arbitrary files, and to insert
necessary instrumentation code for timing purposes.
5. Measure the time for SHA-1 hash generation for the file sizes listed in 1. To do this,
make appropriate changes to the file tempsha1.py (or tempsha1.c). This skeleton
code shows how to use built-in SHA-1 hashing functions, but you will need to augment
it to allow for reading from arbitrary files, and to insert necessary instrumentation code
for timing purposes. You are encouraged to test other hash functions from the library.
6. Measure the time for HMAC signature generation for the file sizes listed in 1. To do
this, make appropriate changes to the file tempHMAC.py (or tempHMAC.c). This
skeleton code shows how to use built-in HMAC functions, but you will need to augment
it to allow for reading from arbitrary files, and to insert necessary instrumentation code
for timing purposes.
7. Prepare a report of your observations in the format requested under Submission.
Part C: PRESENT Algorithm (Optional)
Any student interested in testing more algorithms, we provided the skeleton code for
PRESENT, a lightweight encryption algorithm. You can follow the following instructions to
test the performance of that algorithm. For more details about PRESENT algorithm, please
refer to the paper here.
Measure the encryption/decryption times for PRESENT lightweight encryption and
decryption for the file sizes listed in 1. To do this, make appropriate changes to the file
temppresent.py (or temppresent.cpp). This skeleton code shows how to use the
implemented PRESENT encryption and decryption functions, but you will need to augment it

5 of 5

to allow for reading from arbitrary files, and to insert necessary instrumentation code for timing
purposes.
Note: PRESENT Python implementation may only be able to take hexadecimal string as the
input (0-9, a-f).

热门主题

课程名

eppd1033 m06 ee3025 msci231 bb113/bbs1063 fc709 nbs-7041x mbas902 comp-1027 dpst1091 comp7315 econ0060 comp9417 comp3425 litr1-uc6201.200 ee1102 econ42915 cb9101 math1102e chme0017 fc307 mkt60104 5522usst math39512 cosc2803 omp9727 ddes9903 int2067/int5051 bsb151 mgt253 fc021 babs2202 mis2002s phya21 18-213 cege0012 mdia1002 math38032 mech5125 cisc102 07 mgx3110 cs240 11175 fin3020s eco3420 ictten622 comp9727 cpt111 de114102d mgm320h5s bafi1019 efim20036 mn-3503 math21112 comp9414 fins5568 comp4337 bcpm0054 comp(2041|9044) 110.807 bcpm000028 info6030 inft6800 bma0092 math20212 cs365 ce335 math2010 ec3450 comm1170 cenv6141 ftec5580 ecmt1010 csci-ua.0480-003 econ12-200 ib3960 ectb60h3f cs247—assignment tk3163 ics3u ib3j80 comp20008 comp9334 eppd1063 acct2343 cct109 isys1055/3412 econ7230 math350-real math2014 eec180 msinm014/msing014/msing014b stat141b econ2101 fit2004 comp643 compsci 369 bu1002 cm2030 mn7182sr ectb60h3s ib2d30 ohss7000 fit3175 acct7104 econ20120/econ30320 math226 127.241 info1110 37007 math137a mgt4701 comm1180 fc300 ectb60h3 llp120 bio99 econ7030 csse2310/csse7231 comm1190 110.309 125.330 csc3100 bu1007 comp 636 qbus3600 compx222 stat437 kit317 hw1 ag942 fit3139 115.213 ipa61006 6010acc econ214 envm7512 fit4005 fins5542 slsp5360m 119729 cs148 hld-4267-r comp4002/gam cava1001 or4023 cosc2758/cosc2938 cse140 fu010055 csci410 finc3017 24309 bsys702 mgec61 cive9831m pubh5010 fsc60504 5bus1037 caes1000 plana4310 info90004 p6769 bsan3209 ap/adms4540 ast101h5f plan6392 625.609.81 csmai21 fnce6012 misy262 ifb106tc csci910 502it comp603/ense600 4035 csca08 8iar101 bsd131 msci242l csci 4261 elec51020 blaw1002 ec3044 acct40115 csi2108–cryptographic 158225 7014mhr econ60822 ecn302 philo225-24a acst2001 fit9132 comp1117b ad654 comp3221 st332 cs170 econ0033 engr228-digital
联系我们
EMail: 99515681@qq.com
QQ: 99515681
留学生作业帮-留学生的知心伴侣!
工作时间:08:00-21:00
python代写
微信客服:codinghelp
站长地图