cs5158_hw5_2023
.pdf
keyboard_arrow_up
School
University of Cincinnati, Main Campus *
*We aren’t endorsed by this school
Course
5137
Subject
Computer Science
Date
Dec 6, 2023
Type
Pages
1
Uploaded by AgentMeerkatMaster524
CS 5158/6058 Data Security and Privacy, Fall 2023
Homework 5
Instructor: Dr. Boyang Wang
Due Date:
12/01/2023 (Friday), 11:59pm.
Format:
Please
type
your solutions and submit a pdf of your solutions in Canvas.
Total Points:
7 points
Problem 1 (2.5 points.)
Given a group
G
, the order of this group
p
, and an element
g
of this group,
please explain the following definitions
1. What is the definition of the order of element
g
?
2. What is the definition of a generator of a group?
3. What is a cyclic group?
4. What is Discrete-Logarithmic Problem?
Problem 2 (1.5 points).
Given public parameter (
G, p, g
), where
G
is a cyclic group,
p
is the order
of this group, and
g
is a generator of this group. Assume Alice chooses an integer
a
and Bob selects an
integer
b
1. Please explain the details of Diffie-Hellman Exchange Protocol.
2.
(On additional question for CS6058)
Assume there is a Man-In-The-Middle attack in Diffie-
Hellman Exchange Protocol, and an attacker chooses an integer
c
, please explain the details of this
Man-In-The-Middle attack.
Problem 3 (1 point).
In a Proof of Work (PoW) problem, assume the total number of bits in a hash
value is 10 and the difficulty of this PoW is 8. In addition, we assume the outputs of a hash function are
uniformly distributed.
1. What is the target of this PoW?
2. On average, how many hash operations do we need to find a solution given this target?
Problem 4 (2 points).
Assume the current blockchain in the Bitcoin network has 1
,
234 blocks, the
next block will be added to the blockchain should be No. 1235. In addition, assume the hashing power of
the entire Bitcoin network is 1
,
000
,
000 hashes per second. If Alice would like to mine bitcoins with her
laptop, and she can compute 5
,
000 hashes per second with this laptop
1. What is the probability that
both
block No. 1235 and block No. 1236 in the blockchain will be added
by Alice?
2. If Alice increases her hashing power to 10
,
000 hashes per second and the hashing power of the entire
Bitcoin network increases to 2
,
000
,
000 hashes per second, will Alice have a higher probability to add
the next block into the blockchain?
Discover more documents: Sign up today!
Unlock a world of knowledge! Explore tailored content for a richer learning experience. Here's what you'll get:
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Define the function print_trophic_class_summary(tli3_values) that accepts a list of trophic level index values and prints a summary outlining the number of lakes in each trophic classification, in order from highest trophic classification to lowest. See the examples for the required format.
Notes:
Your function must print the summary, not return it.
In each state line, the initial number should be formatted with width 3. (Hint: :3 will be helpful)
All possible states must be included in the output, even states with zero lakes. The following list will be helpful:
['Hypertrophic', 'Supertrophic', 'Eutrophic', 'Mesotrophic', 'Oligotrophic', 'Microtrophic', 'Ultra-microtrophic']
You must include and use one of your number_in_trophic_class functions (take your pick!), plus your trophic_class function. Basically, you can start with your answer to Question 5 or 6 and add your print_trophic_class_summary function definition after your previous definitions.
For example:
Test
Result…
arrow_forward
subject "graph and optimization"
arrow_forward
Create an mxn (user-defined) factorial matrix using the Rand () function. Make sure the Rand () function is not repeated. The factorial must be computed in a separate function. The factorial matrices can be seen below: (rand () variable range is 0-100)
4! 5! 3! 3!
1! 2! 9! 7!
Calculate the factorials for the final display on the screen. You have permission to specify any range of random variables.
arrow_forward
Solve first 3 functions please protoypes are in the header.
arrow_forward
hi I really need help with this assignment problem
flip_matrix(mat:list)->list
You will be given a single parameter a 2D list (A list with lists within it) this will look like a 2D matrix when printed out, see examples below. Your job is to flip the matrix on its horizontal axis. In other words, flip the matrix horizontally so that the bottom is at top and the top is at the bottom. Return the flipped matrix.
To print the matrix to the console:
print('\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in mat]))
Example:
Matrix:W R I T XH D R L GL K F M VG I S T CW N M N FExpected:W N M N FG I S T CL K F M VH D R L GW R I T X
Matrix:L CS PExpected:S PL C
Matrix:A D JA Q HJ C IExpected:J C IA Q HA D J
arrow_forward
get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.
arrow_forward
help me in question 2
arrow_forward
2. Find the following elements in Z₁,:
a. 13 x₁, 17
b. 13 +19 17
c. -12 (the additive inverse of 12):
d. 12¹ (the multiplicative inverse of 12):
3. Which of the following best characterizes the statements
A) The relation "divides" on the set of prime numbers has the reflexive property
B) The relation "divides" on the set of prime numbers has the symmetric property
a.
Only A is TRUE
b. Only B is TRUE
c. Both A and B are TRUE
d. Both A and B are FALSE
arrow_forward
Data Structures are the programmatic way of storing data so that data can
be used efficiently. Almost every enterprise application uses various types of data
structures in one or the other way. There are various data structure techniques that can
be used for storing data systematically by applying good algorithms.
Design an algorithm that takes two arrays, and returns true if the arrays are
disjoint, i.e. have no elements in common. Use standard data structures and
algorithm in your solution without having to explain how they are
implemented. Write down your algorithm as pseudocode. You don't need to
write Java code but be precise so that a competent programmer should be able
to take your description and easily implement it. Your algorithm should take
Qn log m) time, where n is the size of the larger array and m is the size of the
smaller array. Since n2 m, this is the same as Q(n log m + m log m).
i.
ii.
Describe why it is a bad idea to implement a linked list version a queue which…
arrow_forward
Structural Verification
Structural verification is, in this case, validating that a data structure is formed according to its specification. For this
lab you are given an essentially arbitrary specification, but you could think of this being used to verify a data structure
produced by a program that must have certain properties in order to be used correctly. For example, a list must not
be circular, or an image file might require a particular header describing its contents.
You must implement this function, which examines a matrix and ensures that it adheres to the following specification:
bool verify_matrix(int x, int y, int **matrix);
This function accepts an X dimension, a Y dimension, and a matrix of y rows and x columns; although it is
declared as int **, this is the same type of matrix as returned by parse_life() in PA1, and you should access it as
a two-dimensional array. Note that it is stored in Y-major orientation; that is, matrix ranges from matrix[0][0] to
matrix[y 1][x -…
arrow_forward
Define the function number_in_trophic_class(tli3_values, classification) which takes a list of trophic level index values and a trophic classification, returning the number of lakes in that trophic class. For this version of the question you MUST use a list comprehension. You cannot use a for loop or while loop in your answer.
Notes:
You must include, and use/call your trophic_class function in your submission.
Your tropic_class function must work in the same way it did for Question 2.
You can assume that classification will always be valid, i.e. it will always be one of the states in the following list:
['Hypertrophic', 'Supertrophic', 'Eutrophic', 'Mesotrophic', 'Oligotrophic', 'Microtrophic', 'Ultra-microtrophic']
There are several ways to proceed, but you will probably find either the len function or the count method of the list class useful in conjunction with your list comprehension.
For example:
Test
Result
tli3_list_1 = [4.1061, 2.54561, 4.16276, 2.33801,…
arrow_forward
Please written by computer source
Hello, can you please help me answer this question I am stuck on? Please note we need to develop a code from scratch WITHOUT using cv2.findFundamentalMat() thank you.
arrow_forward
You have a six-element one-dimensional matrix; develop a computer programme to swap the first three elements with the final three elements.
arrow_forward
List the function of group accessors. ?
arrow_forward
c) Draw vector space model by using the following documents.
Doc A:
I am Student
Doc B:
Student I am
Doc C:
X do not like them
arrow_forward
Given the 2 variable function: z = e!-x²-y²
1. x & y should both have 100 evenly spaced values between -3 & 3
2. Create a matrix of values z using nested for loops
3. Create a surface plot of z
4. Create a new matrix (New_z) that is identical to z except: if z>2, New_z=2.
5. Create a surface plot of New_z in a separate figure.
All figures should have appropriate labels and titles
arrow_forward
Please help me with this question,
also respect the exemple please. Thank you
arrow_forward
Do all please
arrow_forward
Write a C program that would:
- Let the users accept a relation.
- Input options should be in Matrix and Listed Method.
- Display the relation through a matrix or listed method.
- Let the user select "Display Properties of Relation"- This will print out the properties of the relation which include Symmetric, Asymmetric, Antisymmetric, Transitive and Reflexive.
##### Listed Display #####
R = {(1,1),(1,3),(2,2),(2,4),(3,1),(3,3),(4,2),(4,4)}
##### Display Properties of Relation ######
- Reflexive
- Symmetric
- Transitive
arrow_forward
Task 7: Consider the following puzzle vector:
Element 1
Element 2
Element 3
Element 4
2
1
3
2
1
2
3
2
Design and explain a concrete data structure that implements this puzzle vector. The data structure must only
consist of elements that can store an integer or a pointer to another element or null - elements can be indexed if they
are contiguous in memory as with an array. You can draw the data structure and explain how the allowed operations
of vectors are implemented on this concrete data structure - additional pointers can be created to traverse lists.
One approach could be to use arrays, or linked lists, or another approach completely.
arrow_forward
A bracket is considered to be any one of the following characters: (, ), {, }, [, or ]. Two brackets are
considered to be a matched pair if the an opening bracket (i.e., (, [, or {) occurs to the left of a closing
bracket (i.e., ), ], or }) of the exact same type. There are three types of matched pairs of brackets: [],
{},and ().
A matching pair of brackets is not balanced if the set of brackets it encloses are not matched. For
example, {[(])} is not balanced because the contents in between { and } are not balanced. Write a
program that take string of bracket pairs from user and reply Yes or No after evaluate. Your program
should working like This.
{[()]} Yes
{[(])} No
{{[[(())]]}} Yes
arrow_forward
Best Practices to Follow:
It’s worth breaking up each functional task in create_blackjack_game() into separate functions. For example, a function to check the score of a player’s hand, to check whether a player has won, and so on. This entire implementation can be done neatly in about eight functions.
Create a Deck of Cards
Complete the create_standard_deck() function, which creates a new deck. The deck itself must be a data structure list. The cards within the deck must be represented as tuples of the form (suit, number), where the suit is a string that must be either ‘hearts’, ‘clubs’, ‘spades’, or ‘diamonds’, and the number is an integer that must be one of the following: 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, or 14. Note that the number used to identify the card has the following association: Jack = 11, Queen = 12, King = 13, and Ace = 14. In terms of value, the picture cards (Jack, Queen, and King) all have a value of 10, and the Ace card has a value of 11. The casino only wants…
arrow_forward
You are required to develop an emergency shelter management system based on layout as illustrated in Figure 2. Let assume the victim’s data have been stored in the system using an array data structure.
arrow_forward
Course: Database *(SQL)*
Please excute the given SQL script (https://drive.google.com/file/d/1zxe_aOhERjVCL54_zbgSLkFTRHYQhOPW/view?usp=sharing) for accessing the data.
The data is described in the following relation schemas:
Airport (airportID, name, city)
Passenger (ticketNo, name, nationality, flightNo, seatNo)FK: flightNo references Flight (flightNo)FK: seatNo references Seat (seatNo)
Flight (flightNo, flightCompany, departAirport, arrivalAirport)FK: departAirport references Airport (airportID)FK: arrivalAirport references Airport (airportID)
Seat (seatNo, flightNo, class)FK: flightNo references Flight (flightNo)
#Construct the SQL statements based on following transactions:
please if you could give all the sql statements needed i will appreciate that, and i promise to put thump up
Transaction
SQL Statement
Retrieve all rows in Airport table for all the airports in London city.
Retrieve all British and German passengers.
Retrieve all names of all the passengers.…
arrow_forward
Course: Database *(SQL)*
Please excute the given SQL script (https://drive.google.com/file/d/1zxe_aOhERjVCL54_zbgSLkFTRHYQhOPW/view?usp=sharing) for accessing the data.
The data is described in the following relation schemas:
Airport (airportID, name, city)
Passenger (ticketNo, name, nationality, flightNo, seatNo)FK: flightNo references Flight (flightNo)FK: seatNo references Seat (seatNo)
Flight (flightNo, flightCompany, departAirport, arrivalAirport)FK: departAirport references Airport (airportID)FK: arrivalAirport references Airport (airportID)
Seat (seatNo, flightNo, class)FK: flightNo references Flight (flightNo)
#Construct the SQL statements based on following transactions:1. Retrieve all rows in Airport table for all the airports in London city.2. Retrieve all British and German passengers.3. Retrieve all names of all the passengers.4. Retrieve the flight number, departure and arrival airports of all British Airways.5. Retrieve the name of every passenger together with their…
arrow_forward
Course: Database *(SQL)*
Please excute the given SQL script (https://drive.google.com/file/d/1zxe_aOhERjVCL54_zbgSLkFTRHYQhOPW/view?usp=sharing) for accessing the data.
The data is described in the following relation schemas:
Airport (airportID, name, city)
Passenger (ticketNo, name, nationality, flightNo, seatNo)FK: flightNo references Flight (flightNo)FK: seatNo references Seat (seatNo)
Flight (flightNo, flightCompany, departAirport, arrivalAirport)FK: departAirport references Airport (airportID)FK: arrivalAirport references Airport (airportID)
Seat (seatNo, flightNo, class)FK: flightNo references Flight (flightNo)
#Construct the SQL statements based on following transactions:
Transaction
SQL Statement
Retrieve all rows in Airport table for all the airports in London city.
Retrieve all British and German passengers.
Retrieve all names of all the passengers.
Retrieve the flight number, departure and arrival airports of all British Airways.
Retrieve the name of…
arrow_forward
Course: Database *(SQL)*
Please excute the given SQL script (https://drive.google.com/file/d/1zxe_aOhERjVCL54_zbgSLkFTRHYQhOPW/view?usp=sharing) for accessing the data.
The data is described in the following relation schemas:
Airport (airportID, name, city)
Passenger (ticketNo, name, nationality, flightNo, seatNo)FK: flightNo references Flight (flightNo)FK: seatNo references Seat (seatNo)
Flight (flightNo, flightCompany, departAirport, arrivalAirport)FK: departAirport references Airport (airportID)FK: arrivalAirport references Airport (airportID)
Seat (seatNo, flightNo, class)FK: flightNo references Flight (flightNo)
#Construct the SQL statements based on following transactions:
Transaction
SQL Statement
Retrieve the flight number, departure and arrival airports of all British Airways.
Retrieve the name of every passenger together with their flight number and the associated company.
Retrieve all flights departed from all airports in London.
Retrieve the ticket numbers…
arrow_forward
Doctor (SSN, FirstName, LastName, Specialty, Years0fExperience, PhoneNum)
Patient(SSN, FirstName, LastName, Address, DOB, PrimaryDoctor_SSN)
Medicine(TradeName, UnitPrice, GenericFlag)
Prescription(Id, Date, Doctor_SSN, Patient_SSN)
Prescription Medicine(Prescription Id, TradeName, NumofUnits)
a. Write a relational algebra expression to list patient's first name, patient's last name,
and primary doctor's first name of all patients.
b. Write a relational algebra expression to list all the prescriptions given by each doctor.
Select TradeName, doctor's first name.
c. Write a relational algebra expression to list the first and last name of patients who
have no prescriptions written by doctors other than their primary doctors.
d. Write SQL statement to retrieve the number of patients that each doctor has written
prescriptions for. You must displav the doctor's first name along with the number of
prescriptions he/she wrote.
e. Write the DDL (SQL) statement to create Prescription_Medicine…
arrow_forward
Please true or false
arrow_forward
Attached below the question!
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L
Related Questions
- Define the function print_trophic_class_summary(tli3_values) that accepts a list of trophic level index values and prints a summary outlining the number of lakes in each trophic classification, in order from highest trophic classification to lowest. See the examples for the required format. Notes: Your function must print the summary, not return it. In each state line, the initial number should be formatted with width 3. (Hint: :3 will be helpful) All possible states must be included in the output, even states with zero lakes. The following list will be helpful: ['Hypertrophic', 'Supertrophic', 'Eutrophic', 'Mesotrophic', 'Oligotrophic', 'Microtrophic', 'Ultra-microtrophic'] You must include and use one of your number_in_trophic_class functions (take your pick!), plus your trophic_class function. Basically, you can start with your answer to Question 5 or 6 and add your print_trophic_class_summary function definition after your previous definitions. For example: Test Result…arrow_forwardsubject "graph and optimization"arrow_forwardCreate an mxn (user-defined) factorial matrix using the Rand () function. Make sure the Rand () function is not repeated. The factorial must be computed in a separate function. The factorial matrices can be seen below: (rand () variable range is 0-100) 4! 5! 3! 3! 1! 2! 9! 7! Calculate the factorials for the final display on the screen. You have permission to specify any range of random variables.arrow_forward
- Solve first 3 functions please protoypes are in the header.arrow_forwardhi I really need help with this assignment problem flip_matrix(mat:list)->list You will be given a single parameter a 2D list (A list with lists within it) this will look like a 2D matrix when printed out, see examples below. Your job is to flip the matrix on its horizontal axis. In other words, flip the matrix horizontally so that the bottom is at top and the top is at the bottom. Return the flipped matrix. To print the matrix to the console: print('\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in mat])) Example: Matrix:W R I T XH D R L GL K F M VG I S T CW N M N FExpected:W N M N FG I S T CL K F M VH D R L GW R I T X Matrix:L CS PExpected:S PL C Matrix:A D JA Q HJ C IExpected:J C IA Q HA D Jarrow_forwardget_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary.arrow_forward
- help me in question 2arrow_forward2. Find the following elements in Z₁,: a. 13 x₁, 17 b. 13 +19 17 c. -12 (the additive inverse of 12): d. 12¹ (the multiplicative inverse of 12): 3. Which of the following best characterizes the statements A) The relation "divides" on the set of prime numbers has the reflexive property B) The relation "divides" on the set of prime numbers has the symmetric property a. Only A is TRUE b. Only B is TRUE c. Both A and B are TRUE d. Both A and B are FALSEarrow_forwardData Structures are the programmatic way of storing data so that data can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way. There are various data structure techniques that can be used for storing data systematically by applying good algorithms. Design an algorithm that takes two arrays, and returns true if the arrays are disjoint, i.e. have no elements in common. Use standard data structures and algorithm in your solution without having to explain how they are implemented. Write down your algorithm as pseudocode. You don't need to write Java code but be precise so that a competent programmer should be able to take your description and easily implement it. Your algorithm should take Qn log m) time, where n is the size of the larger array and m is the size of the smaller array. Since n2 m, this is the same as Q(n log m + m log m). i. ii. Describe why it is a bad idea to implement a linked list version a queue which…arrow_forward
- Structural Verification Structural verification is, in this case, validating that a data structure is formed according to its specification. For this lab you are given an essentially arbitrary specification, but you could think of this being used to verify a data structure produced by a program that must have certain properties in order to be used correctly. For example, a list must not be circular, or an image file might require a particular header describing its contents. You must implement this function, which examines a matrix and ensures that it adheres to the following specification: bool verify_matrix(int x, int y, int **matrix); This function accepts an X dimension, a Y dimension, and a matrix of y rows and x columns; although it is declared as int **, this is the same type of matrix as returned by parse_life() in PA1, and you should access it as a two-dimensional array. Note that it is stored in Y-major orientation; that is, matrix ranges from matrix[0][0] to matrix[y 1][x -…arrow_forwardDefine the function number_in_trophic_class(tli3_values, classification) which takes a list of trophic level index values and a trophic classification, returning the number of lakes in that trophic class. For this version of the question you MUST use a list comprehension. You cannot use a for loop or while loop in your answer. Notes: You must include, and use/call your trophic_class function in your submission. Your tropic_class function must work in the same way it did for Question 2. You can assume that classification will always be valid, i.e. it will always be one of the states in the following list: ['Hypertrophic', 'Supertrophic', 'Eutrophic', 'Mesotrophic', 'Oligotrophic', 'Microtrophic', 'Ultra-microtrophic'] There are several ways to proceed, but you will probably find either the len function or the count method of the list class useful in conjunction with your list comprehension. For example: Test Result tli3_list_1 = [4.1061, 2.54561, 4.16276, 2.33801,…arrow_forwardPlease written by computer source Hello, can you please help me answer this question I am stuck on? Please note we need to develop a code from scratch WITHOUT using cv2.findFundamentalMat() thank you.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- COMPREHENSIVE MICROSOFT OFFICE 365 EXCEComputer ScienceISBN:9780357392676Author:FREUND, StevenPublisher:CENGAGE L
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:9780357392676
Author:FREUND, Steven
Publisher:CENGAGE L