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.

1882 questions
20
votes
8 answers

Encrypting SQLite Database file in iPhone OS

Any SQLite database on the iPhone is simply a file bundled with the application. It is relatively simple for anyone to extract this file and query it. What are your suggestions for encrypting either the file or the data stored within the…
Richard Stelling
  • 25,607
  • 27
  • 108
  • 188
20
votes
5 answers

Creating a checksum on an object graph

This question is related to this one but I think should be asked separately. I have a complex graph of object instances. Now I would like to create a checksum on this object graph directly in memory to detect whether changes have been made to it…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
20
votes
7 answers

How to calculate crc32 checksum from a string on linux bash

I used crc32 to calculate checksums from strings a long time ago, but I cannot remember how I did it. echo -n "LongString" | crc32 # no output I found a solution [1] to calculate them with Python, but is there not a direct way to calculate that…
oxidworks
  • 1,563
  • 1
  • 14
  • 37
20
votes
3 answers

Incremental Checksums

I am looking for a checksum algorithm where for a large block of data the checksum is equal to the sum of checksums from all the smaller component blocks. Most of what I have found is from RFCs 1624/1141 which do provide this functionality. Does…
Steve Severance
  • 6,611
  • 1
  • 33
  • 44
19
votes
7 answers

Combining MD5 hash values

When calculating a single MD5 checksum on a large file, what technique is generally used to combine the various MD5 values into a single value? Do you just add them together? I'm not really interested in any particular language, library or API…
channel72
  • 193
  • 1
  • 1
  • 4
19
votes
4 answers

How could I guess a checksum algorithm?

Let's assume that I have some packets with a 16-bit checksum at the end. I would like to guess which checksum algorithm is used. For a start, from dump data I can see that one byte change in the packet's payload totally changes the checksum, so I…
dpavlin
  • 1,372
  • 2
  • 9
  • 18
18
votes
1 answer

Amazon S3 & Checksum

I try to verify the integrity of a file that was uploaded to a bucket but I don't find any information of this. In the file's headers, there is a "E-tag" but I think its not a md5 checksum. So, how can I check if the file that I uploaded on Amazon…
user863562
18
votes
2 answers

Python equivalent of unix cksum function

I've been looking for the equivalent python method for the unix cksum command: http://pubs.opengroup.org/onlinepubs/7990989775/xcu/cksum.html $ cksum ./temp.bin 1605138151 712368 ./temp.bin So far I have found the zlib.crc32() function >>> import…
Dan
  • 1,029
  • 9
  • 14
17
votes
6 answers

Why modulo 65521 in Adler-32 checksum algorithm?

The Adler-32 checksum algorithm does sums modulo 65521. I know that 65521 is the largest prime number that fits in 16 bits, but why is it important to use a prime number in this algorithm? (I'm sure the answer will seem obvious once someone tells…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
17
votes
7 answers

Ideas to create a small (<10 digits), not (very) secure "hash"

I'm working on an online event ticketing system, where users will be able to self print his tickets and show up at the event where it will be scanned (barcode) and ideally the person will get in. My problem is how to create a "ticket code" that…
Jaime
  • 6,736
  • 1
  • 26
  • 42
17
votes
3 answers

Swift Calculate MD5 Checksum for Large Files

I'm working on creating the MD5 Checksum for large video files. I'm currently using the code: extension NSData { func MD5() -> NSString { let digestLength = Int(CC_MD5_DIGEST_LENGTH) let md5Buffer =…
Mike Walker
  • 2,944
  • 8
  • 30
  • 62
17
votes
3 answers

How to calculate the internet checksum from a byte[] in Java

I'm trying to figure out how to calculate the Internet Checksum in Java and its causing me no end of pain. (I'm horrible at bit manipulation.) I found a version in C# Calculate an Internet (aka IP, aka RFC791) checksum in C#. However my attempt at…
chotchki
  • 4,258
  • 5
  • 34
  • 55
17
votes
3 answers

Checksum in HTTP response header - why not?

I'd like to know some kind of file checksum (like SHA-256 hash, or anything else) when I start downloading file from HTTP server. It could be transferred as one of HTTP response headers. HTTP etag is something similar, but it's used only for…
Greg Witczak
  • 1,634
  • 4
  • 27
  • 56
17
votes
3 answers

rsync how to do a checksum on rsync

When using rsync sometimes the rsync doesn't copy all the files done, below is my code I use. Is they a way to do a checksum or check after the rsync to see if all the files have been copied and if not try again until all files have been copied?…
Grimlockz
  • 2,541
  • 7
  • 31
  • 38
17
votes
8 answers

Generating Luhn Checksums

There are lots of implementations for validating Luhn checksums but very few for generating them. I've come across this one however in my tests it has revealed to be buggy and I don't understand the logic behind the delta variable. I've made this…
Alix Axel
  • 151,645
  • 95
  • 393
  • 500