• HY-TEK CL2 and HY3 CHECKSUM ALGORITHMS

    From B Factor@21:1/5 to jwh on Sun Oct 2 23:04:36 2016
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From devenneymike@gmail.com@21:1/5 to All on Fri Jul 21 06:48:53 2017
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From philipoclarke@googlemail.com@21:1/5 to devenn...@gmail.com on Thu Nov 23 07:20:01 2017
    On Friday, 21 July 2017 14:48:54 UTC+1, devenn...@gmail.com wrote:
    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.

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From healy.ptk@gmail.com@21:1/5 to jwh on Sun Jan 7 05:32:47 2018
    On Thursday, 28 October 2010 21:21:05 UTC+1, jwh wrote:
    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.

    Just want to add my thanks for your time and effort on this. It's a huge time-saver.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From garnerjimswim@gmail.com@21:1/5 to heal...@gmail.com on Thu Mar 14 08:55:22 2019
    On Sunday, January 7, 2018 at 8:32:48 AM UTC-5, heal...@gmail.com wrote:
    On Thursday, 28 October 2010 21:21:05 UTC+1, jwh wrote:
    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.

    Just want to add my thanks for your time and effort on this. It's a huge time-saver.

    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From xraya4t@gmail.com@21:1/5 to jwh on Mon Jun 15 07:25:49 2020
    On Thursday, October 28, 2010 at 10:21:05 PM UTC+2, jwh wrote:
    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.

    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);
    }

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)