TAP protocol checksum issue

Welcome Forums General PowerShell Q&A TAP protocol checksum issue

  • This topic has 2 replies, 2 voices, and was last updated 2 months ago by
    Participant
    .
Viewing 2 reply threads
  • Author
    Posts
    • #251723
      Participant
      Topics: 1
      Replies: 1
      Points: 16
      Rank: Member

      Here is a strange one.  It’s been driving me nuts for a day or so.  I’m trying to write an interface for a paging terminal that accepts message in TAP format.  Part of the message string includes a 7 bit checksum.  A nice explenation is located here: https://everything2.com/title/Telocator+Alphanumeric+Protocol

      The only part giving me grief is the checksum.  I’ve duplicated their example and the result is never correct.  I’m probably missing something stupid.  I’ve search all over and so far no one seems to have done this in PowerShell.

      The process is pretty simple, take a line of text, do a 7 bit binary conversion, convert that to a decimal value, add it together and get a sum.  Take that sum and convert it into a 3 character checksum.  This is all outlined in the previously noted link and in the protocol specification here: https://www.telemessage.com/developer/wp-content/uploads/2014/11/TAP-1.8.pdf

      Here is the part of the code giving me issues.  I broke it out into just the checksum code:

      The “sum” is taken from their example, 379.  That should produce a checksum value of “17;”.  By juggling the formulas I get a lot of different things, mostly “2(+”, which seems to be what it wants to produce.  Any thoughts or suggestions will be appreciated.
      I’m using Windows 10 with PS v 7.0.3.
      • This topic was modified 2 months ago by Kcmjr.
      • This topic was modified 2 months ago by kvprasoon. Reason: code formatting
    • #251861
      Participant
      Topics: 0
      Replies: 15
      Points: 203
      Rank: Participant

      Hi,

      The notes for the example BASIC program explain the behaviour expected from using INT – ‘returns the integer portion of a number’. Using [int] in PowerShell leads to the result being rounded. Use [math]::truncate to achieve the result you need. I was able to obtain the correct checksum using this method.

      Regards,

      Stuart.

    • #252227
      Participant
      Topics: 1
      Replies: 1
      Points: 16
      Rank: Member

      Thanks Stuart,

      I’ll give that a try as soon as I can get back to fighting that particular fire…

Viewing 2 reply threads
  • You must be logged in to reply to this topic.