Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Done Posix 100.32 compliant %@cksum[] function.

Nov
339
7
For pretty much forever, I've quickly compared files residing on Linux server(s) with copies on my local Windows machine using GNU's crc32 command on the former(s) and %@crc32[] on the latter. All was well and good, until...

... my new job, where we use AIX 7.1 servers. Please don't laugh at me. Among several other annoyances, there is no crc32 utility — instead, there's only the Unix standard cksum command, which generates decimal CRC32 values, according to the Posix 100.32 standard, and which differ significantly from the ones generated by GNU's crc32.

I'd like TCC to have a new %@cksum[] function that outputs the decimal CRC32 value of the contents of a file, according to the Posix 100.32 standard.



For the sake of clarity:
- cksum is a standard Unix command; Linux *also* has it, and it performs identically to AIX 7.1 on this regard.
- I'm aware that %@crc32[d, ...] outputs a decimal value. My problem is that %@crc32[d, testFile] doesn't return the same value as cksum testFile.
- Don't touch %@crc32[]! It outputs same as all the *zip programs, which is a great feature in and of itself.

Thanks.
 
According to Wikipedia, there are at least 5 different CRC32 algorithms.
CRC-32
CRC-32C
CRC-32K
CRC-32K2
CRC-32Q
They each use a different polynomial, so will produce different results.
 
So I thought about this: use csum, as above, and forget about my initial request, or nevertheless ask that my proposed %@cksum function is added (either as a new feature of TCMD itself, or as a plugin)?

Considering that cksum is part of the POSIX standard, I think it'd be in everyone's best interest to have it added as a core function. IMHO, of course.
 
I quickly threw together a CKSUM.EXE after stripping down some code I googled up. It gives the same results as my (2003) Gnu CKSUM.EXE (good/bad?). It's 32-bit and (for now) has ZERO error handling. Syntax "CKSUM filename". If it does what's desired I could make it more robust and put it in a plugin or just send the code to Rex. If anyone wants to try it, anonymous FTP to lucky.syr.edu ... CKSUM.ZIP. Let me know ... does it give the desired result?
 
Here's another, including 64-bit and a little error checking. It's attached and also on ftp://lucky.syr.edu. It agrees with CKSUM on the only UNIX system I have access to. I'd really like to know if it's the checksum being discussed here.
 

Attachments

  • cksum.zip
    50.8 KB · Views: 264
Gnu's CKSUM.EXE does the same thing. I don't know if Gnu's coreutils exist in x64 format. I'll send my code to Rex. Maybe he'll include @CKSUM (or something like that) in the next version of TCC.
 
Back
Top