Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HY-TEK CL2 and HY3 CHECKSUM ALGORITHMS

1,160 views
Skip to first unread message

jwh

unread,
Oct 28, 2010, 4:21:05 PM10/28/10
to
HY-TEK Meet Manager CL2 and HY3 File Checksum Algorithms
--------------------------------------------------------

HY3 File Checksum:

We start with this line from an HY3 file:

E1M 8138AnackMB 200E 11 12 0S 4.00 4A 171.37Y 171.37Y
0.00 0.00 NN N 40

We take ONLY columns 1-129 since columns 130-131 contain the checksum
value:

E1M 8138AnackMB 200E 11 12 0S 4.00 4A 171.37Y 171.37Y
0.00 0.00 NN N |

We take and split the line into two different parts, part one is the
ODD numbered columns 1, 3, 5, 7... (I added the | to mark the end):
EM83AakB 20 11 0 40 4 113Y 7.7 00 00 N N |

We simple SUM the values here... For this string we get a checksum of
0x0B1E (done in HEX for clarity)

And part two has the EVEN numbered columns 2, 4, 6, ...:
1 18ncM 0E1 2 S .0 A 7.7 113Y .0 .0 N |

Here, we sum each of the values but multiply each by two before
summing... So we get a checksum of 0x15AC for thsi one.

Next we SUM both checksums:

0x0B1E + 0x15AC = 0x20CA

Then divide by 21 (decimal):

0x20CA -> 8394/21 = 399.71 but we just take the whole number part so
this is 399

Then add 205 to this result:

399 + 205 = 604

From this we take the last two digits backwards which is: 40 !!

-------------------------------------------------------------------------------------------------------------

CL2 File Checksum:

From a CL2 file we use a test line such as:

A01V3 02Meet Results Hy-Tek, Ltd WMM
3.0Cl Hy-Tek, Ltd
866-456-511112052009 MM40 N42

The checksum is contained in the last 4 columns (i.e. 157-160) and in
this case is " N42".

Here we calculate the checksum of the columns 1-156. For this example
we get 7861 or 0x1EB5.

Divide that result by 19 to get 413. Then add 211 to that result to
get 624.

Again we take the last two characters backward. In this case the
result is: 42.

The start of the checksum is either " N" or "NN" and this is
determined by the FIRST 2 CHARACTERs of the line. If the line
starts with "D0" we use "NN". Otherwise we use " N".

So this example line has a checksum value of " N42" according to this
algorithm.

B Factor

unread,
Oct 3, 2016, 2:04:37 AM10/3/16
to
On Thursday, October 28, 2010 at 4:21:05 PM UTC-4, jwh wrote:
> HY-TEK Meet Manager CL2 and HY3 File Checksum Algorithms

Thank you for posting this info! It has saved me a huge amount of time.

One thing I noticed is that the checksum prefix for the "D0" lines is only "NN" for meet results files. The D0 lines in a meet entries file will all have a " N" checksum prefix. Also there are a few D0 lines in meet results files that have a "YN" checksum prefix instead of the much more common "NN" prefix.

devenn...@gmail.com

unread,
Jul 21, 2017, 9:48:54 AM7/21/17
to
I know this is old, hopefully someone hears this! I'm writing this Checksum generation code into an entry file parser I'm writing and I'm stuck on this line

'We simple SUM the values here... For this string we get a checksum of
0x0B1E (done in HEX for clarity)'

I have summed the odd characters a few different ways and I never get '0x0B1E' as my result (yes, I'm converting the result to HEX). What exactly are we summing in each group? Integer values of the characters? Actual value of only the numbers? If anyone could shed any light on this for me I'd really appreciate it.

philip...@googlemail.com

unread,
Nov 23, 2017, 10:20:02 AM11/23/17
to
if you follow jwh explanation exactly it does give the correct checksums, i wrote an excel macro that uses this logic and it produces a hy3 file from imported data

heal...@gmail.com

unread,
Jan 7, 2018, 8:32:48 AM1/7/18
to
Just want to add my thanks for your time and effort on this. It's a huge time-saver.

garner...@gmail.com

unread,
Mar 14, 2019, 11:55:23 AM3/14/19
to
I implemented your code for .hy3 files and with your sample get the same checksum, but it does not work on a real ,hy3 file, is there an update to the method used?

xra...@gmail.com

unread,
Jun 15, 2020, 10:25:50 AM6/15/20
to
Thanks so much.

I implemented quick and dirty in Java:
private static String getCL2checksum(String data) {
Long total = 0l;
for (int i = 0; i < data.length() - 4; i++) {
total += data.charAt(i);
}
Double floor = Math.floor(total/19.0);
long add205 = (long) (floor + 211);
long mod100 = add205 % 100;
long d1 = mod100 % 10;
long d2 = mod100 / 10;
//Boolean nn = data.startsWith("D0");
return String.format(" N%d%d", d1, d2);
}

private static String getHY3checksum(String data) {
Long even = 0l;
Long odd = 0l;
for (int i = 0; i < data.length() - 2; i++) {
if (i % 2 == 0) {
even += data.charAt(i);
} else {
odd += 2 * data.charAt(i);
}
}
Long total = (even + odd);
Double floor = Math.floor(total/21.0);
long add205 = (long) (floor + 205);
long mod100 = add205 % 100;
long d1 = mod100 % 10;
long d2 = mod100 / 10;
return String.format("%d%d", d1, d2);
}
0 new messages