checksum

How to get checksums for strided patterns

I have a 64 bit number (but only the 42 low order bits are used) and need to computer the sum of the 4 bits at n, n+m, n+m*2 and n+m*3 (note: anything that can produce a sum >4 is invalid) for some fixed m and every value of n that places all the bits in the number as an example using m=3 and given the 16-bit number 0010 1011 0110 0001...

How can I calculate the checksum of code at runtime?

I have a C#.NET application running on a machine. How do I calculate the checksum of the entire code at runtime? Note: I do not want to calculate the checksum of the image in use but the actual code part. ...

Directory checksum with python?

So I'm in the middle of web-based filesystem abstraction layer development. Just like file browser, except it has some extra features like freaky permissions etc. I would like users to be notified somehow about directory changes. So, i.e. when someone uploads a new file via FTP, certain users should get a proper message. It is not re...

Why do downloads for various projects have hashcodes or checksums?

I've never used the checksum when downloading various executables or zip files from the Internet. I know it is used to check for consistency and add a bit of security. But is it necessary for when you download from a respectable project like Apache or Microsoft. How many of us actually use the checksums or hashcodes to verify the cont...

Preventing fraudulent submission to a scoreboard

I'm working on the backend for a Flash game and I need to secure the data going into the scoreboard. The game is going to be hosted on many sites in a banner ad, the user will play the game in the advert then click through to the main site to save their details. At the moment I am thinking along the lines of this User plays the game ...

Generate a client-specific verification number for a web service

I have a web service that is outward-facing, however I need to generate a verification system to ensure that a request came from a valid client. Let's say the original web service is defined as follows: [OperationContract] public void Service.RequestMethod (string clientId, int reqNumber, string reqText) { // do stuff with the ...

Algorithm for message code validation

Hi! If you read this thread before - forget everything I wrote, I must have been drunk when I wrote it. I'm starting over: I'm currently working on a project where we will be using some sort of algorithm for validating user input. There are three parties to consider; Client - Browsing our web pages Company - We, handling the Client r...

How to calculate sha1sum of a file in c++?

I tried system calls, but since it`s not the best solution I thought there should be some other way of calculating checksums. Is there any library or function that enables calculating file's checksums in c++ with various algorithms? ...

Fast open source checksum for small strings

I need a quick checksum (as fast as possilbe) for small strings (20-500 chars). I need the source code and that must be small! (about 100 LOC max) If it could generate strings in Base32/64. (or something similar) it would be perfect. Basically the checksums cannot use any "bad" chars.. you know.. the usual (){}[].,;:/+-\| etc Clarifi...

Zlib for Mono/.Net without a known Checksum

I need to implement a special ZLib implementation which should run under .Net and Mono. The data /string messages are received via a socket and thus the checksum is missing. This is about raw string data, not about files. unsigned char zlib_header[]={ // custom additional Zlib Id 'Z', // Our own ID // The normal GZIP heade...

checksum calculation

To calculate CRC I found a piece of code but I am not understanding the concept. Here is the code: count =128 and ptr=some value; calcrc(unsigned char *ptr, int count) { unsigned short crc; unsigned char i; crc = 0; while (--count >= 0) { crc = crc ^ (unsigned short)*ptr++ << 8; i = 8; ...

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 fulfills the following requirements: each "ticket code" need to be sufficiently different fr...

Can I get the MD5sum of a directory with Perl?

I am writing a Perl script (in Windows) that is using File::Find to index a network file system. It works great, but it takes a very long time to crawl the file system. I was thinking it would be nice to somehow get a checksum of a directory before traversing it, and it the checksum matches the checksum that was taken on a previous run...

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 me, but the number-theory parts of my brain just aren't working. Even without expertise i...

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 database. Edit: The App is a game that will be played against other users. Information about a user...

Is there any way to add two bytes with overflow in python?

Hello, I am using pySerial to read in data from an attached device. I want to calculate the checksum of each received packet. The packet is read in as a char array, with the actual checksum being the very last byte, at the end of the packet. To calculate the checksum, I would normally sum over the packet payload, and then compare it to ...

Altering file inside firmware requires new checksum

I have a firmware-file for a picture frame that I want to alter. The purpose of this altering is to make the device display a custom image during boot. I've managed to switch the existing JPEG-file with my own custom file, but it is not possible to flash the device with this new firmware-file. The device complains about an invalid check...

CHECKSUM() collisions in SQL Server 2005

I've got a table of 5,651,744 rows, with a primary key made of 6 columns (int x 3, smallint, varchar(39), varchar(2)). I am looking to improve the performance with this table and another table which shares this primary key plus an additional column added but has 37m rows. In anticipation of adding a column to create the hash key, I did...

Can this checksum algorithm be improved?

We have a very old, unsupported program which copies files across SMB shares. It has a checksum algorithm to determine if the file contents have changed before copying. The algorithm seems easily fooled -- we've just found an example where two files, identical except a single '1' changing to a '2', return the same checksum. Here's the al...

How to build twice the same Linux Kernel sources and get the the same checksum

I'm searching if it's possible to build twice the same Linux Kernel (same sources, same environment, same options, same compiler) and get the the same checksum. Anybody knows how to do? ...