home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PSION / 1997 / 943.ZIP / NDCODE.MCR next >
Encoding:
Text File  |  1997-03-02  |  1.7 KB  |  111 lines

  1. PROC macro:
  2. global l$(255),p$(8),s$(255),v$(30),q(8),n,m,o
  3.  
  4. rem ███████████████████████████████████████
  5. rem █ NDCode - ╕Huub Linthorst, 1997      █
  6. rem █ MacSys macro for text encryption    █
  7. rem █ E-mail: linthors@chem.leidenuniv.nl █
  8. rem ███████████████████████████████████████
  9.  
  10. v$="v.1.0 - ╕Huub Linthorst, 1997"
  11.  
  12. useapp:("active")
  13. if currpid%:<>srvpid%:
  14.     tomacro:
  15.     tofront:
  16. endif
  17. if testsrv%:=0
  18.     p6:
  19. endif
  20. endp
  21.  
  22. proc p6:
  23. if len(gettext$:)>249
  24.     beep:(6,1000)
  25.     giprint:("String too long...")
  26.     goto x::
  27. elseif len(gettext$:)>0
  28.     p1:
  29.     if p$<>""
  30.         l$=gettext$:
  31.         delete:
  32.         p0:
  33.         if o=0
  34.             puttext:(">>>"+s$+"<<<")
  35.         elseif o=1
  36.             puttext:(s$)
  37.         endif
  38.     endif
  39. endif
  40. x::
  41. right:
  42. endp
  43.  
  44. proc p1:
  45. tomacro:
  46. dinit "NDCode "+v$
  47. dxinput p$,"Password"
  48. if dialog
  49.     if len(p$)>0
  50.         tofront:
  51.         p$=mid$(p$+p$+p$+p$+p$+p$+p$+p$,1,8)
  52.         n=1
  53.         while n<9
  54.             q(n)=asc(mid$(p$,n,1))
  55.             n=n+1
  56.         endwh
  57.         if len(l$)>0
  58.             tofront:
  59.             return
  60.         endif
  61.     endif
  62. endif
  63. tofront:
  64. endp
  65.  
  66. proc p0:
  67. n=8
  68. m=1
  69. if mid$(l$,1,3)=">>>" and mid$(l$,len(l$)-2,3)="<<<"
  70.     giprint:("NDCode is decoding...")
  71.     l$=mid$(l$,4,len(l$)-6)
  72.     o=1
  73. else
  74.     giprint:("NDCode is encoding...")
  75.     o=0
  76. endif
  77. while m<=len(l$)
  78.     if o=1
  79.         s$=s$+chr$((asc(mid$(l$,m,1)))-q(n))
  80.     elseif o=0
  81.         s$=s$+chr$((asc(mid$(l$,m,1)))+q(n))
  82.     endif
  83.     m=m+1
  84.     n=n-1
  85.     if n=0
  86.         n=8
  87.     endif
  88. endwh
  89. return
  90. endp
  91.  
  92. proc testsrv%:
  93. local wsrv$(15),in%(6),fmt&,pid%,pfmt%
  94. wsrv$="sys$wsrv.*"+chr$(0)
  95. in%(1)=$100
  96. in%(2)=uadd(addr(wsrv$),1)
  97. if os($88,addr(in%(1))) and 1
  98.     return(in%(1) and $ff)-$100
  99. else
  100.     pid%=in%(1)
  101. endif
  102. pfmt%=addr(fmt&)
  103. if call($683,pid%,4,0,addr(pfmt%),0)<=0
  104.     return -33
  105. endif
  106. if (fmt& and $16)=0
  107.     return -36
  108. endif
  109. endp
  110.  
  111.