home *** CD-ROM | disk | FTP | other *** search
- PROC macro:
- global l$(255),p$(8),s$(255),v$(30),q(8),n,m,o
-
- rem ███████████████████████████████████████
- rem █ NDCode - ╕Huub Linthorst, 1997 █
- rem █ MacSys macro for text encryption █
- rem █ E-mail: linthors@chem.leidenuniv.nl █
- rem ███████████████████████████████████████
-
- v$="v.1.0 - ╕Huub Linthorst, 1997"
-
- useapp:("active")
- if currpid%:<>srvpid%:
- tomacro:
- tofront:
- endif
- if testsrv%:=0
- p6:
- endif
- endp
-
- proc p6:
- if len(gettext$:)>249
- beep:(6,1000)
- giprint:("String too long...")
- goto x::
- elseif len(gettext$:)>0
- p1:
- if p$<>""
- l$=gettext$:
- delete:
- p0:
- if o=0
- puttext:(">>>"+s$+"<<<")
- elseif o=1
- puttext:(s$)
- endif
- endif
- endif
- x::
- right:
- endp
-
- proc p1:
- tomacro:
- dinit "NDCode "+v$
- dxinput p$,"Password"
- if dialog
- if len(p$)>0
- tofront:
- p$=mid$(p$+p$+p$+p$+p$+p$+p$+p$,1,8)
- n=1
- while n<9
- q(n)=asc(mid$(p$,n,1))
- n=n+1
- endwh
- if len(l$)>0
- tofront:
- return
- endif
- endif
- endif
- tofront:
- endp
-
- proc p0:
- n=8
- m=1
- if mid$(l$,1,3)=">>>" and mid$(l$,len(l$)-2,3)="<<<"
- giprint:("NDCode is decoding...")
- l$=mid$(l$,4,len(l$)-6)
- o=1
- else
- giprint:("NDCode is encoding...")
- o=0
- endif
- while m<=len(l$)
- if o=1
- s$=s$+chr$((asc(mid$(l$,m,1)))-q(n))
- elseif o=0
- s$=s$+chr$((asc(mid$(l$,m,1)))+q(n))
- endif
- m=m+1
- n=n-1
- if n=0
- n=8
- endif
- endwh
- return
- endp
-
- proc testsrv%:
- local wsrv$(15),in%(6),fmt&,pid%,pfmt%
- wsrv$="sys$wsrv.*"+chr$(0)
- in%(1)=$100
- in%(2)=uadd(addr(wsrv$),1)
- if os($88,addr(in%(1))) and 1
- return(in%(1) and $ff)-$100
- else
- pid%=in%(1)
- endif
- pfmt%=addr(fmt&)
- if call($683,pid%,4,0,addr(pfmt%),0)<=0
- return -33
- endif
- if (fmt& and $16)=0
- return -36
- endif
- endp
-
-