      SUBROUTINE MAIN
      LOGICAL*1 GETC, XOR
      LOGICAL*1 C, KEY(400), B
      INTEGER GETARG, MOD
      INTEGER I, KEYLEN
      KEYLEN = GETARG(1,KEY,400)
      IF(.NOT.(KEYLEN .EQ. -1 .OR. (KEY(1) .EQ. 63 .AND. KEY(2) .EQ. 0))
     *)GOTO 23000
      CALL ERROR(17Husage: crypt key.)
23000 CONTINUE
      I=1
23002 IF(.NOT.(GETC(C) .NE. -1))GOTO 23004
      IF(.NOT.(C .LT. 32))GOTO 23005
      CALL PUTC(C)
      GOTO 23006
23005 CONTINUE
      B = XOR(C, KEY(I) .AND. 31)
      IF(.NOT.(B .EQ. 127))GOTO 23007
      B = C
23007 CONTINUE
      CALL PUTC(B)
23006 CONTINUE
23003 I = MOD(I,KEYLEN) + 1
      GOTO 23002
23004 CONTINUE
      RETURN
      END
      LOGICAL*1 FUNCTION XOR(A,B)
      LOGICAL*1 A, B
      XOR = (A .AND. .NOT.B) .OR. (.NOT.A .AND. B)
      RETURN
      END
