473,466 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Checksum calculating program

How would I make a program to calculate a checksum? I have the code to
sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!

Feb 21 '06 #1
3 6573
Protoman wrote:
How would I make a program to calculate a checksum? I have the code to
sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!


What checksum algorithm do you want to employ? There are many. Have
you tried looking for their descriptions and implementations on Google?

V
--
Please remove capital As from my address when replying by mail
Feb 21 '06 #2

Victor Bazarov wrote:
Protoman wrote:
How would I make a program to calculate a checksum? I have the code to
sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!


What checksum algorithm do you want to employ? There are many. Have
you tried looking for their descriptions and implementations on Google?

V
--
Please remove capital As from my address when replying by mail


The alg they use for UPC barcodes.

Feb 21 '06 #3
Protoman wrote:
Victor Bazarov wrote:
Protoman wrote:
How would I make a program to calculate a checksum? I have the code
to sum up the digits, but what then? Here's the digit summer:

template <unsigned int I>
int SumDigits()
{
return(I%10)+(SumDigits<I/10>());
}

template <>
int SumDigits<0>() {return 0;}

Some help? Thanks!!!!


What checksum algorithm do you want to employ? There are many. Have
you tried looking for their descriptions and implementations on
Google?

V
--
Please remove capital As from my address when replying by mail


The alg they use for UPC barcodes.


I don't see it defined in the C++ Standard document.
Feb 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Ola Natvig | last post by:
Hi all Does anyone know of a fast way to calculate checksums for a large file. I need a way to generate ETag keys for a webserver, the ETag of large files are not realy nececary, but it would be...
3
by: wilk | last post by:
I have a problem witch calculating TCP or UDP checksum. This is what I found: u16 in_cksum(u16 *addr,int count) { register long sum = 0; /* add 16-bit words */ while (count > 1) { /* this...
2
by: pradeep | last post by:
I have 2 data files, DATA1 and DATA2 , both same. My task is to: Open DATA1, compute the checksum and put it in the end of the file(don't bother about boundary conditions).close DATA1 Open...
6
by: Kevin | last post by:
I'm on Sun 0S 5.8 and need to calculate the checksum of certain sections in an ELF binary file. Specifically .text to .rodata. I'm able to parse through to the program header table and then find...
6
by: Astroman | last post by:
Hi guys and girls. This is my first time posting here so go easy :) . I was wondering if someone could please interpret how this csum() function works in the following C code. I know that the...
1
by: Terry | last post by:
I'm trying to calculate the checksum for UDP packet. The algorithm itself is not difficult (lots of examples out there), but what I'm having the most trouble with is determining the byte order...
3
by: Cyril Vi?ville | last post by:
Hello, as it's written in the subject, I just want to know if it's possible. My app should verify his own chechsum and if those are diff (value and own checksum) i want to display an error...
3
by: fabianuat | last post by:
Could I have some help calculating a checksum for receive data from a Video server? The data is in Hex and the values and here is an example: 20 24 49 4C 30 31 37 38 37 39 CS CS=Checksum the...
1
by: Alex | last post by:
Hi, Is there anyway to calculate a checksum (MD5, CRC32, etc) of files using VB2005? What we need is a simple program that can go through a directory and store the path and file name, checksum,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.