source: FOIAVistA/trunk/r/MAILMAN-XM/XMJMCODE.m@ 1397

Last change on this file since 1397 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.2 KB
Line 
1XMJMCODE ;ISC-SF/GMB-Message En/Decryption ;08/24/2001 10:56
2 ;;8.0;MailMan;;Jun 28, 2002
3 ; Replaces ^XME,^XME1 (ISC-WASH/CAP/THM)
4ENCMSG(XMZ) ; Encode a message
5 N I
6 W:$G(XMIA) !,$$EZBLD^DIALOG(34615) ; Scrambling...
7 S I=.999999
8 F S I=$O(^XMB(3.9,XMZ,2,I)) Q:I'>0 S ^(0)=$$ENCSTR(^XMB(3.9,XMZ,2,I,0))
9 Q
10ENCSTR(XMCLEAR) ; Encode a string
11 N I,XMCODED
12 S XMCODED=""
13 F I=1:1:$L(XMCLEAR) S XMCODED=XMCODED_$C($F(XMSECURE(I#XMSECURE+1),$E(XMCLEAR,I))+30)
14 Q XMCODED
15DECMSG(XMZ) ; Decode a message
16 N I
17 W:$G(XMIA) !,$$EZBLD^DIALOG(34616) ; UnScrambling...
18 S I=.999999
19 F S I=$O(^XMB(3.9,XMZ,2,I)) Q:I'>0 S ^(0)=$$DECSTR(^XMB(3.9,XMZ,2,I,0))
20 Q
21DECSTR(XMCODED) ; Decode a string
22 N I,XMCLEAR
23 S XMCLEAR=""
24 F I=1:1:$L(XMCODED) S XMCLEAR=XMCLEAR_$E(XMSECURE(I#XMSECURE+1),$A(XMCODED,I)-31)
25 Q XMCLEAR
26CRE8KEY(XMKEY,XMHINT,XMABORT) ;
27 D ASKKEY(.XMKEY,.XMABORT) Q:XMABORT
28 N DIR,X,Y
29 S DIR(0)="3.9,1.8"
30 S DIR("A")=$$EZBLD^DIALOG(34617) ; Enter Scramble Hint
31 D ^DIR I $D(DUOUT)!$D(DTOUT) S XMABORT=1 Q
32 S XMHINT=Y
33 Q
34KEYOK(XMZ,XMHINT) ; Ask user for key and make sure it's right
35 N XMKEY,XMTRY,XMOK,XMABORT
36 U IO(0)
37 W !!,$$EZBLD^DIALOG(34624) ; This message has been secured with a password:
38 D NOGOID^XMJMP2(XMZ,$G(^XMB(3.9,XMZ,0)))
39 I " "[XMHINT D
40 . W !,$$EZBLD^DIALOG(34620.1) ; There is no scramble hint.
41 E D
42 . ; The scramble hint is: '_XMHINT_'
43 . W !,$$EZBLD^DIALOG(34620,XMHINT)
44 S (XMOK,XMABORT)=0
45 F XMTRY=1:1:3 D Q:XMOK!XMABORT
46 . D ASKKEY(.XMKEY,.XMABORT) Q:XMABORT
47 . I $$GOODKEY(XMZ,XMKEY) S XMOK=1 Q
48 . W $C(7),$$EZBLD^DIALOG(34621,XMTRY) ; " Not the proper password. Strike _XMTRY_.
49 I 'XMOK,'XMABORT W $$EZBLD^DIALOG(34622) ; " Yer out!
50 I 'XMOK!XMABORT K XMSECURE
51 Q 'XMABORT&XMOK
52ASKKEY(XMKEY,XMABORT) ;
53 F D Q:XMKEY'="?"!XMABORT
54 . W !,$$EZBLD^DIALOG(34618) ; "Enter Scramble Password: "
55 . X ^%ZOSF("EOFF") R XMKEY:15 S:'$T XMKEY=U X ^%ZOSF("EON") U IO
56 . I XMKEY[U S XMABORT=1 Q
57 . I $L(XMKEY)>2,$L(XMKEY)<21 S XMKEY=$$UP^XLFSTR(XMKEY) Q:$L(XMKEY)+1'=$L(XMKEY,$E(XMKEY))
58 . S XMKEY="?"
59 . ;The scramble password is a secret code which must be entered by the
60 . ;reader in order to see the message. Upper and lower case characters
61 . ;are treated the same. (The password is not case sensitive.)
62 . ;The password must be from 3 to 20 characters long, and may not be
63 . ;just one repeating character.
64 . W !
65 . D BLD^DIALOG(34619,"","","XMTEXT","F")
66 . D MSG^DIALOG("WH","","","","XMTEXT")
67 . W !
68 Q
69GOODKEY(XMZ,XMKEY) ; Function checks key and make sure it's right.
70 ; If it is, XMSECURE is defined, and function returns 1;
71 ; Else XMSECURE is not defined, and function returns 0
72 D LOADCODE
73 D ADJUST(.XMKEY)
74 I $$ENCSTR(XMKEY)=$E($G(^XMB(3.9,XMZ,"K")),2,99) Q 1
75 K XMSECURE
76 Q 0
77ADJUST(XMKEY) ; Capitalize the key, pad the key, & adjust cylinder with key
78 N I,J,XMRW
79 S:XMKEY?.E1L.E XMKEY=$$UP^XLFSTR(XMKEY)
80 F Q:$L(XMKEY)>XMSECURE S XMKEY=XMKEY_XMKEY
81 S XMKEY=$E(XMKEY,1,XMSECURE)
82 S XMRW=0
83 F I=1:1:XMSECURE S XMRW=XMRW+$A(XMKEY,I)
84 S XMRW=XMRW#96
85 S:$G(XMPAKMAN) XMPAKMAN("XMRW")=XMRW
86 F I=1:1:XMSECURE D
87 . S J=$F(XMSECURE(I),$E(XMKEY,I))-1+XMRW#40
88 . S XMSECURE(I)=$E(XMSECURE(I),J,999)_$E(XMSECURE(I),1,J-1)
89 Q
90LOADCODE ; Load Bazeries Cylinder
91 N XMLINE,I
92 F I=1:1 S XMLINE=$P($T(Z+I),";",3,9) Q:XMLINE="" S XMSECURE(I)=XMLINE
93 S XMSECURE=I-1
94 Q
95Z ;;
96 ;;j+?F}hmi<Q#uZ|]Jdgwb'52NBr,fP6&:{s./*E(4an)A-Y 7cKMt[Ce;OGD=op"~UL0Xy89x%1lv!VH@\>_R3zkTS$`WI^q
97 ;;~7C|(lbZo5f&mz3*}E{ `eVtGSMN"I>WBy48K/THiu^[1Fcaqp,_L=h.j]X<AP?O$@YQ\d!rU9;:D)2gk+n%J-wR6vs'0x#
98 ;;j+?F}hmi<Q#uZ|]Jdgwb'52NBr,fP6&:{s./*E(4an)A-Y 7cKMt[Ce;OGD=op"~UL0Xy89x%1lv!VH@\>_R3zkTS$`WI^q
99 ;;:eR^K{=o1$+VM3qd@h8ks<W;Hzpu-wbrmTNix?7GYQSlv'*~(4a".c}g[E|%>9O#/0JIF\yj2!Ptn)_D B]C6A&`ZfX,U5L
100 ;;CNl<v_F8sDZfGmUy&ui'%T:+z]$>OVxMw)^n.6d *ge;oY(kjHq,[QE-|WRh2~SP1/}aBL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