      INTEGER I,J,KEYLEN,INC
      INTEGER GETLIN,GETARG,PRMPTQ
      INTEGER LINE(102),KEY(102)
      INTEGER AAAAA0(6)
      DATA AAAAA0/203,229,249,186,160,0/
      KEYLEN=GETARG(1,KEY,102)
      IF((KEYLEN.NE.-1))GOTO 10000
        KEYLEN=PRMPTQ(AAAAA0,KEY,102)
10000 IF((KEYLEN.NE.-1))GOTO 10001
        CALL ERROR('Usage: crypt <key>.')
10001 J=1
      GOTO 10004
10002 J=J+(1)
10004 IF((J.GT.KEYLEN))GOTO 10003
        KEY(J)=XOR(LS(AND(KEY(J),3),3),RS(AND(KEY(J),28),2))
      GOTO 10002
10003 J=KEYLEN
      INC=-1
10005 IF((GETLIN(LINE,-10).EQ.-1))GOTO 10006
        IF((KEYLEN.LE.0))GOTO 10007
          I=1
          GOTO 10010
10008     I=I+(1)
10010     IF((LINE(I).EQ.0))GOTO 10009
            IF((LINE(I).EQ.138))GOTO 10011
              LINE(I)=XOR(LINE(I),KEY(J))
10011       J=J+(INC)
            IF((J.GT.KEYLEN))GOTO 10013
            IF((J.LT.1))GOTO 10013
            GOTO 10012
10013         J=J-(INC*2)
              INC=-INC
10012     GOTO 10008
10009   CONTINUE
10007   CALL PUTLIN(LINE,-11)
      GOTO 10005
10006 CALL SWT
      END
      INTEGER FUNCTION PRMPTQ(PROMPT,REPLY,MAXRE0)
      INTEGER PROMPT(1),REPLY(1)
      INTEGER MAXRE0
      INTEGER LWORD
      INTEGER GETLIN,DUPLX$
      LWORD=DUPLX$(-1)
      CALL DUPLX$(OR(LWORD,:140000))
      CALL PUTLIN(PROMPT,1)
      PRMPTQ=GETLIN(REPLY,1,MAXRE0)
      CALL PUTCH(138,1)
      IF((PRMPTQ.LE.0))GOTO 10014
      IF((REPLY(PRMPTQ).NE.138))GOTO 10014
        REPLY(PRMPTQ)=0
        PRMPTQ=PRMPTQ-(1)
10014 CALL DUPLX$(LWORD)
      RETURN
      END
C ---- Long Name Map ----
C maxreply                       maxre0
