From: Holger Kiehl <Holger.Kiehl@dwd.de>
To: Luciano Miguel Ferreira Rocha <luciano@lsd.di.uminho.pt>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Question about checksums
Date: Thu, 21 Aug 2003 16:36:45 +0000 (GMT) [thread overview]
Message-ID: <Pine.LNX.4.44.0308211617560.6771-100000@praktifix.dwd.de> (raw)
In-Reply-To: <20030821132005.GA8614@lsd.di.uminho.pt>
On Thu, 21 Aug 2003, Luciano Miguel Ferreira Rocha wrote:
> On Thu, Aug 21, 2003 at 12:48:05PM +0000, Holger Kiehl wrote:
> > Hello
> >
> > Lets me first start to explain what I try to do. I have a big ascii
> > configuration file (appr. 500KB), which I split up in many smaller
> > jobs each approx. 180 Bytes (average, minimum is 50 maximum 5120 Bytes).
> > For each job I would like to generate a unique number, so that I can
> > refer to these jobs by their individual numbers.
> >
> > What is the best way to generate a checksum from each job? Also I would
> > like that the checksums are always the same, when you calculate it
> > on a different host with different CPU and OS but using the same
> > job data.
>
> Why not just use the number of the job?
>
This is what I currently do. It however has the disadvantage that with
each change to the configuration file the number is increased and the
job numbers do not have a direct relationship with the job itself. There
is no way for me to trace back a job number with the job itself.
> Or the offset from the file of the job?
>
The problem here is that the user can move a job from the beginning of
the configuration to the end, ie. the jobs themself can 'flow' arround
in the configuration file.
> > I think md5sum could do the job but, think it is a bit of an overkill
> > to generate a 128 Bit checksum for such small input data. Also storing
> > such huge numbers is a bit of a pain. Would a 32 or 64 Bit checksum
> > sufficient, or would I be running into problems when these are to
> > short?
>
> CRC-32 is normally sufficient. It's designed for data corruption on
> transmission, though, but it should be OK as long as you don't expect
> people to try and break your code with equal checksums.
>
I am not trying to make anything more secure. Will a CRC-32 be sufficient
to always generate a different sum if a single bit changes within the
maximum 5120 Bytes?
Thanks,
Holger
next prev parent reply other threads:[~2003-08-21 16:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-21 12:48 Question about checksums Holger Kiehl
2003-08-21 13:20 ` Luciano Miguel Ferreira Rocha
2003-08-21 16:36 ` Holger Kiehl [this message]
2003-08-21 17:28 ` Jeff Woods
2003-08-22 20:18 ` Holger Kiehl
2003-08-23 20:31 ` printf(), aligning fields J.
2003-08-24 0:07 ` Glynn Clements
2003-08-24 1:05 ` Stephen Satchell
2003-08-21 18:19 ` Question about checksums Luciano Miguel Ferreira Rocha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.44.0308211617560.6771-100000@praktifix.dwd.de \
--to=holger.kiehl@dwd.de \
--cc=linux-c-programming@vger.kernel.org \
--cc=luciano@lsd.di.uminho.pt \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).