🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.mail.uucp
Article #5337

Re: UUCP documentation!

#5337
From: Russell Schulz
Date: Tue, 03 Jan 1995 00:44
54 lines
2652 bytes
(followups redirected; posted and mailed)

jorge@laser.satlink.net (Jorge Cwik) writes:

> Every decent Uucp reference should come with the 'g' checksum
> algorithm. Although all the ones I've seen include code in C,
> and not in pascal as you requested in another post.

it's fairly trivial to express in some Pascal-derived languages, like Turbo:
(unfortunately, my version has no word-based xor builtin)

function wxor(w1,w2: word): word;

begin
  wxor := (w1 or w2)-(w1 and w2);
end;

function checksumof(apacket: datapackett; completelen: integer): word;

var
  check1: word;
  check2: word;
  i: integer;
  onebyte: byte;

{check1 and check2 have to be 16-bit quantities, or do a lot of AND $FFFF}

{this routine copied from Taylor's UUCP Internals FAQ}

begin
  check1 := $ffff;
  check2 := 0;

  for i := 1 to completelen do
    begin
      if (check1 and $8000)=0 then
        check1 := check1 shl 1
      else
        check1 := (check1 shl 1)+1;

      onebyte := apacket[i];

      inc(check1,onebyte);

      inc(check2,wxor(check1,completelen-i+1));

      if (onebyte=0) or (check1<onebyte) then
        check1 := wxor(check1,check2);
    end;

  checksumof := check1;
end;
-- 
Russell Schulz  russell@alpha3.ersys.edmonton.ab.ca  ersys!rschulz  Shad 86c
Technical Details
Message-ID: <950102.174411.1W0.rusnews.w164w@alpha3.ersys.edmonton.ab.ca>
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!netnews.upenn.edu!dsinc!spool.mu.edu!agate!library.ucla.edu!psgrain!nntp.cs.ubc.ca!alberta!adec23!ersys!alpha3!russell
References: <3dsl1h$drd@lightning.powertech.no> <ac33Xc1w165w@laser.satlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6800,7d8c3ff49022bdec
X-Google-Attributes: gidf6800,public
X-Google-Thread: 10d3b3,7d8c3ff49022bdec
X-Google-Attributes: gid10d3b3,public
X-Google-Thread: 105278,7d8c3ff49022bdec
X-Google-Attributes: gid105278,public
X-Google-Thread: f8287,7d8c3ff49022bdec
X-Google-Attributes: gidf8287,public
X-Google-Thread: fe2bc,7d8c3ff49022bdec
X-Google-Attributes: gidfe2bc,public
X-Google-Thread: f4f6f,7d8c3ff49022bdec
X-Google-Attributes: gidf4f6f,public
X-Google-ArrivalTime: 1995-01-02 22:13:40 PST
Path: arc1-ca.pugleaf.net!nntp.gmd.de!newsserver.jvnc.net!netnews.upenn.edu!dsinc!spool.mu.edu!agate!library.ucla.edu!psgrain!nntp.cs.ubc.ca!alberta!adec23!ersys!alpha3!russell
From: russell@alpha3.ersys.edmonton.ab.ca (Russell Schulz)
Newsgroups: comp.mail.uucp,alt.bbs.pcbuucp,alt.sys.amiga.uucp,can.uucp,de.comm.uucp,tor.uucp
Subject: Re: UUCP documentation!
Message-ID: <950102.174411.1W0.rusnews.w164w@alpha3.ersys.edmonton.ab.ca>
Date: Mon, 2 Jan 1995 17:44:11 -0700
References: <3dsl1h$drd@lightning.powertech.no> <ac33Xc1w165w@laser.satlink.net>
Reply-To: russell@alpha3.ersys.edmonton.ab.ca (Russell Schulz)
Followup-To: comp.mail.uucp
Organization: Private System, Edmonton, AB, Canada
CC: harald@lightning.powertech.no
X-Newsreader: rusnews v1.21+
Lines: 54