Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CRC8/16 or even 32, anyone?
#11
Zire:
If you are adding a CRC algorithm to a "standalone" program, any of the algorithms posted can suit you.

If you are trying to match someone else's CRC, you may have some problems, as there is several ways to do a CRC: you an use different "polynomials", you can use reverse calculation, a constant may be added at the end of calc.... . This tutorial from Bob Stout C snippets explains it all:
http://c.snippets.org/snip_lister.php?fname=crc.txt
Antoni
Reply
#12
Antonio, It's for a standalone, so the algos already psted are good.


Moneo, Hmm, the shell/batch file approach would be too slow and memory consuming =(.
Reply
#13
Plus, you'd need PKZIP, which is copyrighted software ... although I have the real thing... I think version 2... on a diskette at home. Smile Retro! Goes well with QB. Smile

@antoni: very thorough reference! It looks as if all the major CRC32 implementations are the same, too, which is a Good Thing.
Reply
#14
Quote:....Moneo, Hmm, the shell/batch file approach would be too slow and memory consuming =(.
Zire,
With today's fast machines, speed problems are mostly a thing of the past. Unless your target file is 100MB or larger, you will not notice the difference. Plus, the suggested program which does the shell, only does it once.

Also, how many times a day are you going to require this CRC generator? Let's say you need it 10 times a day (which I doubt), then finding a faster approach which saves you 5 seconds per run will save you 50 seconds a day, wow!

If you only need it once in a while, run the batchfile by hand and retrieve the CRC from the temp file with notepad, or type the temp file to the screen.
*****
Reply
#15
He said he was going to use it for the filesystem for his fake OS, so he's probably going to CRC every file that's accessed. My guess is that he needs all the speed he can get...
Reply
#16
Plus using external executables is a security hole as big as a cathedral.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#17
Quote:He said he was going to use it for the filesystem for his fake OS, so he's probably going to CRC every file that's accessed. My guess is that he needs all the speed he can get...
Quote:Plus using external executables is a security hole as big as a cathedral.

Nice, I didn't even have to answer =)


I will calculate the CRC at start and shutdown of Novix, for each file in NVXFS. So speed is an issue, one second extra per file means one extra second's delay at boot and shutdown.

Security problems, sure, not that Novix is going to be used for anything serious (I doubt it)

But I like to use "my own" code, as it gives more freedom then using the shell approach.


Not to mention that I would have to detect if the user was running WinXP and add CMD to the shell to make it work, blarg!
Reply
#18
Ok, ok, I was just suggesting some simple, quick and dirty ways to get a CRC.

There's still the CRC generator program that I wrote in "C", which I already mention to you. It's fast (uses the table method), and the resultant CRC-32 is the same as Pkzip, which makes it very easy to check out. Are you interested in this code?

NATHAN, regarding your comment of "Plus using external executables is a security hole as big as a cathedral". That's only true if your external executabes have not been duly approved by your security administration. Can you imagine any system in today's Internet/Intranet environments that could only use internally developed executables, or only being able to use executables for software developed by Microsoft? What about Oracle, Adobe, McAfee, Norton, WinZip, Java, etc. Would you classify these as "security violating external executables"?
*****
Reply
#19
Nope, 'cause they use certificates and sessions to communicate. But still, there's a big security hole: see how easy is to infect a Windows system.

Imagine that you use PKZIP/PKUNZIP to calculate/check the CRC. Someone can rename his VIRUS.EXE to PKZIP.EXE and do whatever he or she wants. When you have to rely in an external executable for a task 'cause you can't do it otherwise, okay, but if you can avoid it, go ahead.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#20
Quote:Nope, 'cause they use certificates and sessions to communicate. But still, there's a big security hole: see how easy is to infect a Windows system.

Imagine that you use PKZIP/PKUNZIP to calculate/check the CRC. Someone can rename his VIRUS.EXE to PKZIP.EXE and do whatever he or she wants. When you have to rely in an external executable for a task 'cause you can't do it otherwise, okay, but if you can avoid it, go ahead.
Nathan,
I'm not familiar with the terms "certificates and sessions", but I assume you mean programs that are officially installed in Windows using the Control Panel/Add or Remove Programs method which I understand makes them part of the Registry.
If this method protects programs from being changed or renamed, then I get what you mean, and you're right. Thanks.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)