Lines Matching refs:Checksum
7 This program has classes and functions to encode, decode, calculate checksum
14 <version><checksum><payload_size><payload>. <version> is the version number
15 of the "echo request" protocol. <checksum> is the checksum of the <payload>.
19 <version><checksum><payload_size><key><encoded_payload>.<version>,
20 <checksum> and <payload_size> are same as what is in the "echo request" message.
36 This class knows how to parse the checksum, payload_size from the
37 "echo request" and "echo response" messages. It holds the checksum,
44 # This specifies the starting position of the checksum and length of the
45 # checksum. Maximum value for the checksum is less than (2 ** 31 - 1).
59 def __init__(self, checksum=0, payload_size=0):
60 """Initializes the checksum and payload_size of self (EchoHeader).
63 checksum: (int)
64 The checksum of the payload.
68 self.checksum = checksum
74 This method extracts checksum, and payload_size from the echo_message
76 initializes self (EchoHeader) with checksum and payload_size.
86 self.checksum = int(echo_message[
94 It calculates checksum for the payload and initializes self (EchoHeader)
95 with the calculated checksum and size of the payload.
108 self.checksum = Checksum(payload, self.payload_size)
116 checksum_string = EchoHeader.CHECKSUM_FORMAT % self.checksum
138 This method extracts the header information (checksum and payload_size) and
155 It calculates checksum for the payload and initializes self (EchoRequest)
225 It gets the checksum, payload_size and payload from the echo_request object
233 self.checksum = echo_request.checksum
267 def Checksum(payload, payload_size):
268 """Calculates the checksum of the payload.
272 The payload string for which checksum needs to be calculated.
277 The checksum of the payload.
279 checksum = 0
282 checksum += ord(payload[i])
283 return checksum
315 the checksum of the EchoRequest is same as the calculated checksum of the
339 if Checksum(echo_request.payload,
340 echo_request.payload_size) != echo_request.checksum:
356 checksum match EchoRequest's.
384 return (echo_request.checksum == echo_response.checksum and