我们都习惯于通过Internet或其他本地网络发送数据。通常,此类数据以比特的形式通过网络传输。通常,当通过网络发送大量数据时,很容易由于网络问题甚至恶意攻击而导致数据丢失。校验和用于确保接收到的数据没有受到损害并且没有错误和丢失。校验和(Checksum)充当数据的指纹或唯一标识符。
为了更好地理解这一点,请考虑一下:我正在通过某个快递代理向您发送一篮苹果。现在,由于送货代理是第三方,我们不能完全依赖他的真实性。因此,为了确保他在途中没有吃任何苹果并且您收到所有苹果,我打电话给您并告诉您我已经给您发送了 20 个苹果。收到篮子后,您数数苹果的数量并检查是否为 20。
这个苹果数就是校验和对您的文件所做的。如果您通过网络(第三方)发送了一个非常大的文件,或者您从 Internet 下载了一个文件,并且您想确保该文件已正确发送或接收,您可以在您的文件上应用校验和算法,该算法正在将值发送并传达给接收者。接收文件后,接收方将应用相同的算法,并将获得的值与您发送的值相匹配。如果值匹配,则文件已正确发送并且没有数据丢失。但如果值不同,接收方将立即知道某些数据已丢失或文件已通过网络被篡改。由于数据可能对我们非常敏感和重要,因此检查传输过程中可能发生的任何错误非常重要。所以,校验和对于维护数据的真实性和完整性非常重要。即使是非常小的数据变化也会导致校验和发生重大变化。协议如TCP/IP也使用校验和来确保始终传送正确的数据。
校验和基本上是一种使用加密哈希函数的算法。该算法在通过网络发送和接收数据之前和之后应用于一段数据或文件。您可能已经注意到它在下载链接旁边提供,因此当您下载文件时,您可以在自己的计算机上计算校验和并将其与给定值匹配。请注意,校验和的长度不取决于数据的大小,而是取决于所使用的算法。最常用的校验和算法是MD5(消息摘要(Message Digest)算法 5)、SHA1(安全散列算法 1 )(Secure Hashing Algorithm 1))、SHA-256 和 SHA-512。这些算法分别产生 128 位、160 位、256 位和 512 位哈希值。SHA-256 和 SHA-512 比SHA-1和MD5更新且更强大,后者在极少数情况下会为两个不同的文件生成相同的校验和值。这损害了这些算法的有效性。较新的技术是防错和更可靠的。散列算法主要将数据转换为二进制等价物,然后对其进行一些基本的操作,如AND, OR ,XOR等,最后提取计算的十六进制值。
什么是校验和?以及如何计算校验和
方法 1: (Method 1: )使用PowerShell计算校验和(Calculate Checksums)
1.使用Windows 10(Windows 10)开始菜单上的搜索并键入PowerShell并从列表中单击“ Windows PowerShell ”。
2.或者,您可以右键单击开始并从菜单中选择“ Windows PowerShell ”。
3.在Windows PowerShell中,运行以下命令:
Get-FileHash yourFilePath
For example, Get-FileHash C:\Users\hp\Desktop\myfile.docx
4.提示默认显示SHA-256哈希值。( SHA-256 hash value by default.)
5.对于其他算法,您可以使用:
Get-FileHash yourFilePath –Algorithm MD5
Or
Get-FileHash yourFilePath –Algorithm SHA1
您现在可以将获得的值与给定的值匹配。
方法2:使用在线校验和计算器计算校验和(Method 2: Calculate Checksum using Online Checksum Calculator)
有许多在线校验和计算器,例如“onlinemd5.com”。该站点可用于计算任何文件甚至任何文本的MD5、SHA1和SHA-256校验和。(SHA-256)
1.单击“选择文件(Choose file)”按钮并打开您想要的文件。
2.或者,将文件拖放到给定的框中。
3.选择您想要的算法并获得所需的校验和。( desired algorithm and obtain the required checksum.)
4.您还可以通过将给定的校验和复制到“比较:”文本框中,将获得的校验和与给定的校验和匹配。
5.您会在文本框旁边看到相应的勾号或叉号。
直接计算字符串或文本的哈希值:(To calculate the hash for a string or text directly:)
a) 向下滚动页面到“ MD5 & SHA1 Hash Generator For Text ”
b) 将字符串复制到给定的文本框中以获得所需的校验和。
对于其他算法,您可以使用“ https://defuse.ca/checksums.htm ”。该站点为您提供了许多不同散列算法值的广泛列表。单击(Click)“选择文件”以选择您的文件,然后单击“计算校验和...(Calculate Checksums…) ”以获取结果。
方法 3:使用 MD5 和 SHA 校验和实用程序(Method 3: Use MD5 & SHA Checksum Utility)
首先,下载 MD5 & SHA Checksum Utility(download the MD5 & SHA Checksum Utility),然后双击 exe 文件启动它。只需(Simply)浏览您的文件,您就可以获得其MD5、SHA1、SHA-256或 SHA-512 哈希值。您还可以将给定的哈希复制粘贴到相关的文本框中,以便轻松地将其与获得的值匹配。
受到推崇的:(Recommended:)
我希望以上步骤对学习什么是校验和有所帮助?以及如何计算它;(What is Checksum? And How to Calculate it;)但如果您对本文仍有任何疑问,请随时在评论部分提出。
What is Checksum? And How to Calculate Checksums
We all are used to sending data over the Internet or other local networks. Typically, such data is transferred over the netwоrk in the form of bits. Generally, when tons оf data is being sent over a network, it is susceptible to data loss due to a network issue or even a malicious attack. A checksum is used to ensure that the data received is unharmed and free of errors and loѕsеs. Checksum acts as a fingerрrint or a unique identifier for the data.
To understand this better, consider this: I am sending you a basket of apples via some delivery agent. Now, since the delivery agent is a third party, we can’t rely on his authenticity entirely. So to ensure that he has not eaten any apples on his way and that you receive all the apples, I call you up and tell you that I have sent you 20 apples. On receiving the basket, you count the number of apples and check if it is 20.
This count of apples is what checksum does to your file. If you have sent a very large file over a network (third party) or you have downloaded one from the internet and you want to make sure that the file has been correctly sent or received, you apply a checksum algorithm on your file which is being sent and communicate the value to the receiver. On receiving the file, the receiver will apply the same algorithm and match the obtained value with what you have sent. If the values match, the file has been sent correctly and no data has been lost. But if the values are different, the receiver will instantly know that some data has been lost or the file has been tampered with over the network. Since the data may be highly sensitive and important to us, it is important to check any error that might have occurred while transmission. So, a checksum is very important to maintain data authenticity and integrity. Even a very small change in data causes a major change in the checksum. Protocols like TCP/IP which govern the communication rules of the internet also use the checksum to make sure that always correct data is delivered.
A checksum is basically an algorithm that uses a cryptographic hash function. This algorithm is applied over a piece of data or a file before sending and after receiving it over a network. You might have noticed that it is provided beside a download link so that when you download the file, you can calculate the checksum on your own computer and match it with the given value. Note that the length of a checksum does not depend upon the size of data but on the algorithm used. The most common checksum algorithms used are MD5 (Message Digest algorithm 5), SHA1 (Secure Hashing Algorithm 1), SHA-256 and SHA-512. These algorithms produce 128-bit, 160-bit, 256 -bit and 512-bit hash values respectively. SHA-256 and SHA-512 are more recent and stronger than SHA-1 and MD5, which in some rare cases produced the same checksum values for two different files. This compromised the validity of those algorithms. The newer techniques are error proof and more reliable. Hashing algorithm mainly converts the data to its binary equivalent and then carries some basic operations like AND, OR, XOR, etc. on it and finally extracts the hex value of the computations.
What is checksum? And How to Calculate Checksums
Method 1: Calculate Checksums using PowerShell
1.Use the search on start menu on Windows 10 and type PowerShell and click on ‘Windows PowerShell’ from the list.
2.Alternatively, you can right click on start and select ‘Windows PowerShell’ from the menu.
3.In the Windows PowerShell, run the following command:
Get-FileHash yourFilePath
For example, Get-FileHash C:\Users\hp\Desktop\myfile.docx
4.The prompt will display SHA-256 hash value by default.
5.For other algorithms, you can use:
Get-FileHash yourFilePath –Algorithm MD5
Or
Get-FileHash yourFilePath –Algorithm SHA1
You can now match the obtained value with the given value.
Method 2: Calculate Checksum using Online Checksum Calculator
There are many online checksum calculators like ‘onlinemd5.com’. This site can be used to calculate MD5, SHA1 and SHA-256 checksums for any file and even for any text.
1.Click on the ‘Choose file’ button and open your desired file.
2.Alternatively, drag and drop your file into the given box.
3.Select your desired algorithm and obtain the required checksum.
4.You can also match this obtained checksum with the given checksum by copying the given checksum into the ‘Compare with:’ textbox.
5.You will see the tick or the cross beside the text box accordingly.
To calculate the hash for a string or text directly:
a)Scroll down the page to ‘MD5 & SHA1 Hash Generator For Text’
b)Copy the string into the given text box to obtain the required checksum.
For other algorithms, you can use ‘https://defuse.ca/checksums.htm’. This site gives you an extensive list of many different hashing algorithm values. Click on ‘Choose file’ to select your file and click on ‘Calculate Checksums…’ to get the results.
Method 3: Use MD5 & SHA Checksum Utility
First, download the MD5 & SHA Checksum Utility then launch it by double-clicking on the exe file. Simply browse your file and you can obtain its MD5, SHA1, SHA-256, or SHA-512 hash. You can also copy-paste the given hash into the relevant textbox to easily match it with the obtained value.
Recommended:
I hope the above steps were helpful in learning What is Checksum? And How to Calculate it; but if you still have any questions regarding this article then feel free to ask them in the comment’s section.