Question
The capabilities assumed of an attacker when public-key cryptography isused for authentication, as when studying the Needham-Schroder-Loweprotocol, are that it can pair messages, split paired
The capabilities assumed of an attacker when public-key cryptography isused for authentication, as when studying the Needham-Schroder-Loweprotocol, are that it can pair messages, split paired messages, encryptmessages under a public key and decrypt messages under a public key if ithas access to the private key.Give four SPL processes Spy1, . . . , Spy4representing these capabilities.[4 marks](ii) Give a further two processes Spy5, Spy6representing the capabilityof an attacker to encrypt and decrypt messages when symmetric-keycryptography is used. [2 marks](b) Let PSpy =!(fi?{1,...,6}Spyi). Draw the events of the Petri net forPSpy k S k A k B.For PSpy, only show those from Spy5 and Spy6. [7 marks](c) Secrecy of the message m can be viewed as m never being output directly to thenetwork by either the participants in the protocol or the attacker
Complete the function below that will perform a random move for the given player. The function will return the move (from-piece and to-piece).
The pseudo code is attached below:
# return True if the input move (from-square and to-square) is legal, else False
# this is the KEY function which contains the rules for each piece type
def IsMoveLegal():
# input is from-square and to-square
# use the input and the board to get the from-piece and to-piece
# if from-square is the same as to-square
# return False
# if the from-piece is a "pawn"
## case - pawn wants to move one step forward (or backward if white)
# if to-square is empty and is in the same column as the from-square
# return True
## case - pawn can move two spaces forward (or backward if white) ONLY if pawn on starting row
# else if to-square is empty and from-square-row = 2 (or 7 if white) and to-square-row = from-square-row + 2 (or -2 if white)
# if IsClearPath() - a clear path exists between from-square and to-square
# return True
## case - pawn attacks the enemy piece if diagonal
# else if there is piece diagonally forward (or backward if white) and that piece belongs to the enemy team
# return True
# else if the from-piece is a "rook"
# if to-square is either in the same row or column as the from-square
# if to-square is either empty or contains a piece that belongs to the enemy team
# if IsClearPath() - a clear path exists between from-square and to-square
# return True
# else if the from-piece is a "bishop"
# if to-square is diagonal wrt from-square
# if to-square is either empty or contains a piece that belongs to the enemy team
# if IsClearPath() - a clear path exists between from-square and to-square
# return True
# else if the from-piece is a "queen"
## SAME as "rook"
# if to-square is either in the same row or column as the from-square
# if to-square is either empty or contains a piece that belongs to the enemy team
# if IsClearPath() - a clear path exists between from-square and to-square
# return True
## SAME as "bishop"
# if to-square is diagonal wrt from-square
# if to-square is either empty or contains a piece that belongs to the enemy team
# if IsClearPath() - a clear path exists between from-square and to-square
# return True
# else if the from-piece is a "knight"
# calculate the col-diff = to-square-col - from-square-col
# calculate the row-diff = to-square-row - from-square-row
# if to-square is either empty or contains a piece that belongs to the enemy team
# return True for any of the following cases:
# col-diff = 1 & row_dif = -2
# col-diff = 2 & row_dif = -1
# col-diff = 2 & row_dif = 1
# col-diff = 1 & row_dif = 2
# col-diff = -1 & row_dif = -2
# col-diff = -2 & row_dif = -1
# col-diff = -2 & row_dif = 1
# col-diff = -1 & row_dif = 2
# else if the from-piece is a "king"
# calculate the col-diff = to-square-col - from-square-col
# calculate the row-diff = to-square-row - from-square-row
# if to-square is either empty or contains a piece that belongs to the enemy team
# return True for any of the following cases:
# abs(col-diff) = 1 & abs(row_dif) = 0
# abs(col-diff) = 0 & abs(row_dif) = 1
# abs(col-diff) = 1 & abs(row_dif) = 1
# return False - if none of the other True's are hit above
# gets a list of legal moves for a given piece
# input = from-square
# output = list of to-square locations where the piece can move to
def GetListOfLegalMoves():
# input is the current player and the given piece as the from-square
# initialize the list of legal moves, i.e., to-square locations to []
# go through all squares on the board
# for the selected square as to-square
# call IsMoveLegal() with input as from-square and to-square and save the returned value
# if returned value is True
# call DoesMovePutPlayerInCheck() with input as from-square and to-square and save the returned value
# if returned value is False
# append this move (to-square) as a legal move
# return the list of legal moves, i.e., to-square locations
# gets a list of all pieces for the current player that have legal moves
def GetPiecesWithLegalMoves():
# initialize the list of pieces with legal moves to []
# go through all squares on the board
# for the selected square
# if the square contains a piece that belongs to the current player's team
# call GetListOfLegalMoves() to get a list of all legal moves for the selected piece / square
# if there are any legel moves
# append this piece to the list of pieces with legal moves
# return the final list of pieces with legal moves
# returns True if the current player is in checkmate, else False
def IsCheckmate():
# call GetPiecesWithLegalMoves() to get all legal moves for the current player
# if there is no piece with any valid move
# return True
# else
# return False
# returns True if the given player is in Check state
def IsInCheck():
# find given player's King's location = king-square
# go through all squares on the board
# if there is a piece at that location and that piece is of the enemy team
# call IsMoveLegal() for the enemy player from that square to the king-square
# if the value returned is True
# return True
# else
# do nothing and continue
# return False at the end
# helper function to figure out if a move is legal for straight-line moves (rooks, bishops, queens, pawns)
# returns True if the path is clear for a move (from-square and to-square), non-inclusive
def IsClearPath():
# given the move (from-square and to-square)
# if the from and to squares are only one square apart
# return True
# else
# if to-square is in the +ve vertical direction from from-square
# new-from-square = next square in the +ve vertical direction
# else if to-square is in the -ve vertical direction from from-square
# new-from-square = next square in the -ve vertical direction
# else if to-square is in the +ve horizontal direction from from-square
# new-from-square = next square in the +ve horizontal direction
# else if to-square is in the -ve horizontal direction from from-square
# new-from-square = next square in the -ve horizontal direction
# else if to-square is in the SE diagonal direction from from-square
# new-from-square = next square in the SE diagonal direction
# else if to-square is in the SW diagonal direction from from-square
# new-from-square = next square in the SW diagonal direction
# else if to-square is in the NE diagonal direction from from-square
# new-from-square = next square in the NE diagonal direction
# else if to-square is in the NW diagonal direction from from-square
# new-from-square = next square in the NW diagonal direction
# if new-from-square is not empty
# return False
# else
# return the result from the recursive call of IsClearPath() with the new-from-square and to-square
# makes a hypothetical move (from-square and to-square)
# returns True if it puts current player into check
def DoesMovePutPlayerInCheck():
# given the move (from-square and to-square), find the 'from-piece' and 'to-piece'
# make the move temporarily by changing the 'board'
# Call the IsInCheck() function to see if the 'player' is in check - save the returned value
# Undo the temporary move
# return the value saved - True if it puts current player into check, False otherwise
Write program to read and write 10 elements in an array.
2. Write program to read and write n elements in an array . Write program to read 2 numbers. Display the greatest of all. 2. Write a program to read 'n' numbers from the keyboard and print the sum and average. Write program to read an integer value doubles it and subtract 10 then display the result.
A multicore processor consists of eight scalar cores. Each core has private 8KB L1 instruction and data caches. The cores are supported by a 4MB L2 cache that is 8-way banked. Communication between the cores and the L2 cache banks takes place over two crossbar switches (one for communication in each direction). The L2 cache maintains a directory that shadows the L1 tags. The L1 caches are write-through, with allocate on load and no-allocate on stores. (a) Describe a simple cache coherence protocol suitable for this processor. [8 marks] (b) In the simple scheme you have described, what states may L1 cache lines be in? [2 marks] (c) Why might it be better to shadow the L1 tags rather than adding state to each L2 cache line? [5 marks] (d) What advantages does your protocol have over a simple snooping coherence protocol running over a shared bus? [5 marks] 2 CST.2015.8.3 2 Computer Systems Modelling (a) A Poisson process of rate ? has inter-event times X1, X2, . . . that are independent Exponential random variables with parameter ?. (i) Show that the random variables for i = 1, 2, . . . satisfy the memoryless property P(Xi > t + s|Xi > t) = P(Xi > s) where s and t are any positive real numbers. [2 marks] (ii) Suppose that T1, T2, . . . , Tn is an observed sequence of n consecutive event times. Describe what tests you could conduct of the hypothesis that the observed events arise from a Poisson process of some given rate ?. [6 marks] (b) (i) Describe the M/G/1 queue model explaining the mathematical assumptions made and the required features of the queue. [4 marks] (ii) Suppose that the arrival rate for the M/G/1 queue is ? customers per second, that the service rate is customers per second and assume that ? = ?/ < 1. Define the utilization, U, of the server and show that U = ?. (iii) A busy period of the M/G/1 queue is a period of time which starts when the server becomes occupied and continues until the server is no longer occupied. An idle period is the period of time between consecutive busy periods. Explain how to find the mean length of an idle period. Using your result for the utilization of the server in part (b)(ii), derive an expression for the mean length, ? , of a busy period.
Question 12 What are the dominant strategies in the following game? Derpy Horse Classics South Asian Studies Chinese Language and Literature Middle Eastern Languages Horsey Derp Mathematics Statistics 7, 15 8, 11 1,6 4,11 9,8 11, 13 5, 1 6, 13 Actuarial Science 8,91 92, 14 9,7 10, 22 O South Asian Studies, Middle Eastern Languages, Computer Science O South Asian Studies, Actuarial Science O Computer Science, Actuarial Science O Chinese Language and Literature, Computer Science O Chinese Language and Literature, Mathematics Computer Science 15,3 18, 5 2,5 13, 16 1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started