For working professionals
For fresh graduates
More
1. Introduction
6. PyTorch
9. AI Tutorial
10. Airflow Tutorial
11. Android Studio
12. Android Tutorial
13. Animation CSS
16. Apex Tutorial
17. App Tutorial
18. Appium Tutorial
21. Armstrong Number
22. ASP Full Form
23. AutoCAD Tutorial
27. Belady's Anomaly
30. Bipartite Graph
35. Button CSS
39. Cobol Tutorial
46. CSS Border
47. CSS Colors
48. CSS Flexbox
49. CSS Float
51. CSS Full Form
52. CSS Gradient
53. CSS Margin
54. CSS nth Child
55. CSS Syntax
56. CSS Tables
57. CSS Tricks
58. CSS Variables
61. Dart Tutorial
63. DCL
65. DES Algorithm
83. Dot Net Tutorial
86. ES6 Tutorial
91. Flutter Basics
92. Flutter Tutorial
95. Golang Tutorial
96. Graphql Tutorial
100. Hive Tutorial
103. Install Bootstrap
107. Install SASS
109. IPv 4 address
110. JCL Programming
111. JQ Tutorial
112. JSON Tutorial
113. JSP Tutorial
114. Junit Tutorial
115. Kadanes Algorithm
116. Kafka Tutorial
117. Knapsack Problem
118. Kth Smallest Element
119. Laravel Tutorial
122. Linear Gradient CSS
129. Memory Hierarchy
133. Mockito tutorial
134. Modem vs Router
135. Mulesoft Tutorial
136. Network Devices
138. Next JS Tutorial
139. Nginx Tutorial
141. Octal to Decimal
142. OLAP Operations
143. Opacity CSS
144. OSI Model
145. CSS Overflow
146. Padding in CSS
148. Perl scripting
149. Phases of Compiler
150. Placeholder CSS
153. Powershell Tutorial
158. Pyspark Tutorial
161. Quality of Service
162. R Language Tutorial
164. RabbitMQ Tutorial
165. Redis Tutorial
166. Redux in React
167. Regex Tutorial
170. Routing Protocols
171. Ruby On Rails
172. Ruby tutorial
173. Scala Tutorial
175. Shadow CSS
178. Snowflake Tutorial
179. Socket Programming
180. Solidity Tutorial
181. SonarQube in Java
182. Spark Tutorial
189. TCP 3 Way Handshake
190. TensorFlow Tutorial
191. Threaded Binary Tree
196. Types of Queue
197. TypeScript Tutorial
198. UDP Protocol
202. Verilog Tutorial
204. Void Pointer
205. Vue JS Tutorial
206. Weak Entity Set
207. What is Bandwidth?
208. What is Big Data
209. Checksum
211. What is Ethernet
214. What is ROM?
216. WPF Tutorial
217. Wireshark Tutorial
218. XML Tutorial
Checksum in computer networks is used to ensure the integrity of data transmitted from the sender to the receiver. It involves performing a mathematical calculation on the data, which generates a checksum value. This checksum value is appended to the end of the original data unit before transmission.
Here's a summary of the error detection code - checksum and its algorithmic process.
Checksum in computer networks are applied to ensure data integrity. When data is sent from a sender to a receiver, it may be susceptible to errors due to noise, interference, or other issues in the communication channel. The checksum acts as a simple and efficient error detection method to identify such errors.
By generating a checksum from the data and appending it to the transmitted message, the receiver can independently calculate the checksum upon receiving the data. If the received checksum matches the calculated checksum, it indicates that the data was likely transmitted correctly without any errors.
In case the calculated checksum at the receiver's end differs from the received checksum, it signifies that errors have occurred during transmission. In such cases, the receiver can request the sender to retransmit the data or take other appropriate actions to ensure accurate data delivery. Applying checksum helps in maintaining data integrity and improving the overall reliability of data transmission in networks.
Checksum is a mathematical algorithm used to verify data integrity and detect errors in digital data. It is commonly used in data transmission and storage to ensure that the data received or stored matches the original data. Here are the steps to calculate a simple checksum for a given set of data:
Data Representation: The data to be protected by the checksum is represented in a binary format. This means each character or byte in the data is converted to its corresponding binary representation.
Split Data: Divide the data into fixed-size segments or blocks. The size of these segments can vary depending on the specific checksum algorithm being used.
Checksum Algorithm: Choose a checksum algorithm suitable for your application. Commonly used algorithms include CRC (Cyclic Redundancy Check), Adler-32, and Fletcher's checksum, among others.
Checksum Calculation: Apply the chosen checksum algorithm to each segment of the data. The algorithm will perform calculations on the binary values of the data in the segment and produce a checksum value.
Checksum Concatenation: Concatenate the individual checksums of all segments to create the final checksum for the entire data.
Transmit or Store the Data: Send or store the original data along with the calculated checksum.
Data Reception or Retrieval: When receiving or retrieving the data, the recipient or reader will also calculate the checksum of the received or retrieved data using the same algorithm.
Compare Checksums: Compare the calculated checksum with the received or retrieved checksum. If the two checksums match, it indicates that the data is likely to be error-free and has been transmitted or stored correctly. If the checksums differ, it suggests that errors have occurred during data transmission or storage.
Error Handling: In case of a checksum mismatch, the recipient or reader can request a retransmission of the data or take other appropriate error correction measures.
It's important to note that the specific steps and algorithms used for checksum computation can vary depending on the application and requirements. Some algorithms are more robust and provide better error-detection capabilities than others. The choice of algorithm and the size of the checksum can impact the efficiency and reliability of the error detection process.
Here is an example of using the checksum function:
Code:
def calculate_checksum(data):
checksum = 0
for byte in data:
checksum ^= byte
return checksum
def main():
# Sample data represented as a list of bytes (you can modify this as per your data)
data = [0x01, 0x23, 0x45, 0x67, 0x89]
# Calculate the checksum
checksum = calculate_checksum(data)
# Print the result
print("Data:", data)
print("Calculated Checksum:", hex(checksum))
if __name__ == "__main__":
main()
In this code, the calculate_checksum function takes a list of bytes as input and returns the checksum calculated using the XOR operation. The main function demonstrates how to use the calculate_checksum function with sample data. You can modify the data list to represent your own data.
Remember that this is just a simple example using the XOR operation. In practical applications, you might want to use more sophisticated checksum algorithms like CRC or Adler-32, depending on your specific needs. Additionally, the way you represent and interpret the data will vary based on your use case (e.g., ASCII, UTF-8, binary data, etc.).
Explanation:
Sample Output:
If we run this code with the provided sample data, the output will be:
Data: [1, 35, 69, 103, 137]
Calculated Checksum: 0x7e
In this example, the XOR operation is used as a simple checksum calculation technique. However, for more robust error detection, other checksum algorithms like CRC or Adler-32 are often preferred. The choice of the checksum algorithm depends on the specific requirements and the level of error detection needed for the application.
Error detection code - checksum offers several advantages in the realm of error detection for digital communication.
Even though checksum has many advantages in error detection, it also has some drawbacks:
Checksum plays a crucial role in ensuring data integrity and detecting errors in digital communication. It provides a simple and efficient means to detect corruption or tampering during transmission, safeguarding the accuracy and reliability of data exchanges.
As technology continues to advance, checksum algorithms will remain indispensable in various applications, from file transfers and network communications to data storage and cybersecurity.
If you want to master this crucial function, consider taking up a Computer Science certification from upGrad. With the course by upGrad you will be able to master checksum online. The courses by upGrad will also help you seek employment in leading roles in the tech industry.
1. What are the limitations of checksum?
Checksum has its constraints that include poor error detection and correction capability, susceptibility to errors, and sensitivity to the size of the data packet.
2. How many types of checksums are there?
There are 14 types of checksums.
3. Which checksum is better than MD5?
The hash value produced by the SHA-256 algorithm is 256 bits or 64 hexadecimal digits. According to recent research, it is significantly better than either MD5.
Author
Talk to our experts. We are available 7 days a week, 9 AM to 12 AM (midnight)
Indian Nationals
1800 210 2020
Foreign Nationals
+918045604032
1.The above statistics depend on various factors and individual results may vary. Past performance is no guarantee of future results.
2.The student assumes full responsibility for all expenses associated with visas, travel, & related costs. upGrad does not provide any a.