Questions tagged [checksum]

A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage. The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one.

A checksum or hash sum is a fixed-size datum computed from an arbitrary block of digital data for the purpose of detecting accidental errors that may have been introduced during its transmission or storage.

The integrity of the data can be checked at any later time by recomputing the checksum and comparing it with the stored one. This process doesn't guarentee the data hasn't been corrupted, but is a good indication.

1694 questions
538
votes
21 answers

Getting a File's MD5 Checksum in Java

I am looking to use Java to get the MD5 checksum of a file. I was really surprised but I haven't been able to find anything that shows how to get the MD5 checksum of a file. How is it done?
Jack
  • 18,975
  • 11
  • 46
  • 47
383
votes
6 answers

Generating an MD5 checksum of a file

Is there any simple way of generating (and checking) MD5 checksums of a list of files in Python? (I have a small program I'm working on, and I'd like to confirm the checksums of the files).
Alexander
  • 4,830
  • 5
  • 21
  • 19
142
votes
18 answers

How to compare 2 files fast using .NET?

Typical approaches recommend reading the binary via FileStream and comparing it byte-by-byte. Would a checksum comparison such as CRC be faster? Are there any .NET libraries that can generate a checksum for a file?
Robin Rodricks
  • 99,791
  • 133
  • 372
  • 575
132
votes
9 answers

What is the fastest way to create a checksum for large files in C#

I have to sync large files across some machines. The files can be up to 6GB in size. The sync will be done manually every few weeks. I cant take the filename into consideration because they can change anytime. My plan is to create checksums on the…
crono
  • 3,443
  • 3
  • 24
  • 24
131
votes
5 answers

How does git compute file hashes?

The SHA1 hashes stored in the tree objects (as returned by git ls-tree) do not match the SHA1 hashes of the file content (as returned by sha1sum) $ git cat-file blob 4716ca912495c805b94a88ef6dc3fb4aff46bf3c |…
netvope
  • 6,297
  • 7
  • 29
  • 41
125
votes
13 answers

Hash Code and Checksum - what's the difference?

My understanding is that a hash code and checksum are similar things - a numeric value, computed for a block of data, that is relatively unique. i.e. The probability of two blocks of data yielding the same numeric hash/checksum value is low enough…
Richard Ev
  • 48,781
  • 54
  • 181
  • 273
117
votes
7 answers

How is a CRC32 checksum calculated?

Maybe I'm just not seeing it, but CRC32 seems either needlessly complicated, or insufficiently explained anywhere I could find on the web. I understand that it is the remainder from a non-carry-based arithmetic division of the message value, divided…
aquanar
  • 1,301
  • 2
  • 9
  • 8
83
votes
20 answers

What is the best way to calculate a checksum for a file that is on my machine?

I'm on a Windows machine and I want to run a checksum on the MySQL distribution I just got. It looks like there are products to download, an unsupported Microsoft tool, and probably other options. I'm wondering if there is a consensus for the best…
Bialecki
  • 26,315
  • 33
  • 78
  • 103
80
votes
5 answers

Is it possible to get identical SHA1 hash?

Given two different strings S1 and S2 (S1 != S2) is it possible that: SHA1(S1) == SHA1(S2) is True? If yes - with what probability? If not - why not? Is there a upper bound on the length of a input string, for which the probability of getting…
Andriy Drozdyuk
  • 50,346
  • 44
  • 149
  • 256
67
votes
16 answers

How to generate an MD5 checksum for a file in Android?

In my app I have a requirement to generate an MD5 checksum for a file. Could you please tell me if there is any way in which this can be achieved? Thank you.
Ingrid Cooper
  • 1,121
  • 2
  • 14
  • 25
66
votes
7 answers

Windows equivalent of linux cksum command

I am looking for a way to compute crc checksum cross platform. cksum works on Linux, AIX, HP-UX Itanium, Solaris, is there a equivalent command of linux cksum in windows too? %cksum run.sh 1491301976 652 run.sh Note: no third party tool
AabinGunz
  • 10,828
  • 47
  • 140
  • 205
61
votes
4 answers

How do I do a SHA1 File Checksum in C#?

How do I use the SHA1CryptoServiceProvider() on a file to create a SHA1 Checksum of the file?
Firesteel
  • 649
  • 1
  • 5
  • 3
57
votes
2 answers

What checksum algorithm should I use?

I'm building a system which needs to be able to find if blobs of bytes have been updated. Rather than storing the whole blob (they can be up to 5MBs), I'm thinking I should compute a checksum of it, store this and compute the same checksum a little…
Julien Genestoux
  • 26,486
  • 19
  • 63
  • 91
57
votes
6 answers

Can a TCP checksum fail to detect an error? If yes, how is this dealt with?

If a TCP payload gets corrupted in transit the recomputed checksum won't match the transmitted checksum. Great, all fine so far. If a TCP checksum gets corrupted in transit the recomputed checksum won't match the now corrupted checksum. Great, all…
52
votes
12 answers

File containing its own checksum

Is it possible to create a file that will contain its own checksum (MD5, SHA1, whatever)? And to upset jokers I mean checksum in plain, not function calculating it.
zakovyrya
  • 9,203
  • 5
  • 36
  • 28
1
2 3
99 100