CRC for betting
ZXNet echo conference «code.zx»
From Yuri Burawtsow → To All 23 August 1998
Hi, All!
The subject algorithm is better, pls.
Bye, Yuri.
From Aleksandr Majorov → To Yuri Burawtsow 24 August 1998
23-08-98 15:41:00 Yuri Burawtsow ==> All
Hi Yuri!
YB> The subject algorithm is better, pls.
Here I picked something up in my archive:
figure it out yourself...
These are just pieces of several files where this is mentioned...
== Cut ==
Structure of the 17-byte header added to TR-DOS
files using HoBeta.exe:
00-07 - file name
08 - file type
09-0A - Start
0B-0C - Length
0D-0E - Length in 256-byte records (byte 0E - size in sectors)
0F-10 - Checksum
Thus, the first 14 bytes are copied from the TR-DOS directory.
Checksum calculation: S=S+257*Di+i, where
S initial=0
Di - byte value
i - byte sequence number (if I’m not mistaken, starting from 0, not 1)
C src:
*/
#include
#include
#include
#include
#include
#include
#include
void main(int argc, char *argv[])
{
int inh, outh, i, inlen, outlen, CheckSum, w, t;
char *file;
unsigned char buf[10];
union {
struct {
unsigned char tr_filename[8];
unsigned char tr_filetype;
unsigned int tr_address;
unsigned int tr_length;
unsigned int tr_tr;
unsigned int tr_crc;
} tr_head;
unsigned char head[17];
} header;
file = argv[1];
w = *buf;
inh = open(file, O_BINARY|O_RDWR);
inlen = filelength(inh);read(inh, header.head, 17);
CheckSum=0;
for (i=0; i<=14; CheckSum = CheckSum + (header.head[i] * 257) + i,
i++);
if (header.tr_head.tr_crc != CheckSum) {
printf("Not hobeta!!");
exit(1);
}
printf("Found file ");
for (i=0; i<=7; i++) printf("%c", header.head[i]);
printf(" <%c> %d byte", header.head[8], header.tr_head.tr_length);
/*
unsigned int CheckSum;
CheckSum=0;
for (i=0; i<=14; CheckSum = CheckSum + (header.head[i] * 257) + i, i++);
header.tr_head.tr_crc = CheckSum;
/*I found such a funny way of counting in one of my programs
header checksum:
checksum=0;
for (i=0; i<=14; checksum+=(unsigned char)*(bufptr+i), i++);
checksum*=257;
checksum+=105;
bufptr is obviously a pointer to the beginning of the header.
=== Cut ===
Well that's all
*MAS* with a sledgehammer
From Yuri Burawtsow → To Aleksandr Majorov 26 August 1998
Greetings to you, oh dearest Aleksandr!
On a lunar day 08/24/98 at 22:30:00 someone Aleksandr Majorov in
finally wrote 2 Yuri Burawtsow on the topic 'CRC for
hobeting'.
23-08-98 15:41:00 Yuri Burawtsow ==>> All
[skipatizhi]
AM> figure it out yourself...
Thank you, I figured it out. I thought I needed a control
read the sum of the entire file, but it turns out that only three
descriptor...
In short, I wrote here a small MS-DOS-like echo processor.
Who is it for? For writers without HAYES, but with Specky,
to which VICOMM (or XTR) is connected. That is, for those
like me. Boris Sokol has also shown interest in this development...
How to set DN, NC, VC or anything similar?
1. Write the reaction to the extension in the extension file
unread echo (for example, '*.$e'). Run the tosser.exe file;
2. Write a reaction to the extension '*.mai' - extension
personal unanswered letter. Run the file echoproc.exe;
3. Write a reaction to the extension '*.re' - extension
of the answered letter. Run the glue.exe file;
4. Customize the files to suit your characteristics and email format:
general.cfg
mailsys.cfg.
What should you do before using the processor?
1. Copy the latest echoes and letters from the diskette.
2. Name the freshly copied files something special. Ehi,
for example, they are already called '*.$e'.
How to use the processor?1. Being in some shell, highlight the echoes one by one
another and press ENTER on each (processing the marked ones for now
not implemented). A launched tosser does:
- search for letters addressed to the operator and select them from the file under
names 'xxxx.mai