source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUMF5AT.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: 7.2 KB
Line 
1XUMF5AT ;ISS/PAVEL - XUMF5 MD5 Hash Testing API ;06/17/05
2 ;;8.0;KERNEL;**383**;July 10, 1995
3 ;
4 ;;original name was 'VESOUHSH' ; Secure hash functions
5 ;;(c) Copyright 1994 - 2004, ESI Technology Corp, Natick MA
6 ;; This source code contains the intellectual property of its copyright holder(s),
7 ;; and is made available under a license. If you are not familiar with the terms
8 ;; of the license, please refer to the license.txt file that is a part of the
9 ;; distribution kit.
10 ; THIS IS TESTING VERSION
11 Q
12 ;;**************************************************
13 ;;MD5 'R'egular portion of the code. This will handle
14 ;; one string at a time.
15 ;;**************************************************
16 ;
17TESTR ; Run Regular test suite and verify values
18 N OK
19 S OK=1
20 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU(""))'="d98c1dd404b2008f980980e97e42f8ec" OK=0
21 W !,"MD5 for """" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU(""))
22 W !,"MD5 reversed for """" =",$$MAIN^XUMF5BYT($$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU(""))))
23 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("a"))'="b975c10ca8b6f1c0e299c33161267769" OK=0
24 W !,"MD5 for ""a"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("a"))
25 W !,"MD5 reversed for ""a"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("a")))
26 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("abc"))'="98500190b04fd23c7d3f96d6727fe128" OK=0
27 W !,"MD5 for ""abc"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("abc"))
28 W !,"MD5 reversed for ""abc"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("abc")))
29 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("message digest"))'="7d696bf98d93b77c312f5a52d061f1aa" OK=0
30 W !,"MD5 for ""message digest"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("message digest"))
31 W !,"MD5 reversed for ""message digest"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("message digest")))
32 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("abcdefghijklmnopqrstuvwxyz"))'="d7d3fcc300e492616c49fb7d3be167ca" OK=0
33 W !,"MD5 for ""abcdefghijklmnopqrstuvwxyz"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("abcdefghijklmnopqrstuvwxyz"))
34 W !,"MD5 reversed for ""abcdefghijklmnopqrstuvwxyz"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("abcdefghijklmnopqrstuvwxyz")))
35 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"))'="98ab74d1f5d977d22c1c61a59f9d419f" OK=0
36 W !,"MD5 for ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"))
37 W !,"MD5 reversed for ""ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")))
38 S:$$HEX^XUMF5AU($$MD5R^XUMF5AU("12345678901234567890123456789012345678901234567890123456789012345678901234567890"))'="a2f4ed5755c9e32b2eda49ac7ab60721" OK=0
39 W !,"MD5 for ""12345678901234567890123456789012345678901234567890123456789012345678901234567890"" =",$$HEX^XUMF5AU($$MD5R^XUMF5AU("12345678901234567890123456789012345678901234567890123456789012345678901234567890"))
40 W !,"MD5 reversed for ""12345678901234567890123456789012345678901234567890123456789012345678901234567890"" =",$$MAIN^XUMF5BYT($$HEX^XUMF5AU($$MD5R^XUMF5AU("12345678901234567890123456789012345678901234567890123456789012345678901234567890")))
41 I OK=1 W !,"Tests passed." Q
42 W !,"Tests failed."
43 Q
44TESTE ; Run Enhanced test suite and verify values
45 N OK,MYABCD
46 S OK=1
47 S MYA=$C(1,35,69,103)
48 S MYB=$C(137,171,205,239)
49 S MYC=$C(254,220,186,152)
50 S MYD=$C(118,84,50,16)
51 S MYABCD=MYA_MYB_MYC_MYD
52 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,""))'="d98c1dd404b2008f980980e97e42f8ec" OK=0
53 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"a"))'="b975c10ca8b6f1c0e299c33161267769" OK=0
54 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"abc"))'="98500190b04fd23c7d3f96d6727fe128" OK=0
55 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"message digest"))'="7d696bf98d93b77c312f5a52d061f1aa" OK=0
56 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"abcdefghijklmnopqrstuvwxyz"))'="d7d3fcc300e492616c49fb7d3be167ca" OK=0
57 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"))'="98ab74d1f5d977d22c1c61a59f9d419f" OK=0
58 S:$$HEX^XUMF5AU($$MD5E^XUMF5AU(MYABCD,"12345678901234567890123456789012345678901234567890123456789012345678901234567890"))'="a2f4ed5755c9e32b2eda49ac7ab60721" OK=0
59 I OK=1 W !,"Tests passed." Q
60 W !,"Tests failed."
61 Q
62 ;Pavel's testing stuff
63 ;FIND DEPENDENCY for loaded packages...
64 ;Scann whole environment for discrepances...
65FDEP N DIC,Y,X,IEN,TMP,ERR,X0,START,RR
66 S X0=0,START=1
67 K ^TMP("LIST",$J)
68 F K ^TMP("DEP",$J),^TMP("DEPX",$J) S X0=$O(^XPD(9.6,"B",X0)) Q:'$L(X0) S IEN=$O(^XPD(9.6,"B",X0,0)) Q:'IEN D
69 .I START W !!,?5,"****** Builds, for which not all required packages have been installed ******",! S START=0
70 .I $$GETDEP(IEN,1) W !,"IEN: ",IEN,?10,X0 S ^TMP("LIST",$J,X0)=IEN
71 K ^TMP("DEP",$J),^TMP("DEPX",$J)
72 R !!,"Do you want detail list tree for each one ?? N// ",RR:60
73 Q:'$L(RR)!(RR["^") Q:$E($TR(RR,"y","Y"))'="Y"
74 S X0=""
75 F S X0=$O(^TMP("LIST",$J,X0)) Q:'$L(X0) S IEN=^(X0) D
76 .K ^TMP("DEP",$J),^TMP("DEPX",$J)
77 .S LEV=1 I '$$GETDEP(IEN,LEV) W !,"No dependency for: ",$P(Y,U,2) Q
78 .S OK=0 F Q:$$LOOP(LEV) S LEV=LEV+1
79 .S $P(II,"-",79)="-"
80 .W !!!,"****** Required builds of ",X0," NOT installed on system ******",!,II
81 .S LEV=0 F S LEV=$O(^TMP("DEP",$J,LEV)) Q:'LEV S II=0 F S II=$O(^TMP("DEP",$J,LEV,II)) Q:'II W !,"LEV: ",LEV,?8,II,?20,$P(^(II),U),?45,$P(^(II),U,2)
82 W !!!,"DONE",!
83 Q
84BUILD ;ENTRY FOR CHECKING OF DEPENDENCY TREE
85 N DIC,Y,X,IEN,TMP,ERR
861 K ^TMP("DEP",$J),^TMP("DEPX",$J)
87 S DIC=9.6,DIC(0)="AZEQZ" D ^DIC Q:Y=-1 S IEN=+Y_","
88 S LEV=1
89 I '$$GETDEP(IEN,LEV) W !,"No dependency for: ",$P(Y,U,2) G 1
90 ;Recursive loop for dependencies
91 ;Loop and delete entry which is loaded.
92 S OK=0
93 F Q:$$LOOP(LEV) S LEV=LEV+1
94 S $P(II,"-",75)="-"
95 W !!,?4,"****** Required builds of ",$P(Y,U,2)," NOT installed on system ******",!,II
96 S LEV=0 F S LEV=$O(^TMP("DEP",$J,LEV)) Q:'LEV S II=0 F S II=$O(^TMP("DEP",$J,LEV,II)) Q:'II W !,"LEV: ",LEV,?8,II,?20,$P(^(II),U),?45,$P(^(II),U,2)
97Q W ! G 1
98 ;
99 Q
100LOOP(LEV) ;LOOP and Kill if not dependencess
101 N II,OK,X1,Y,DIC,X,IEN,TMP
102 S II=0
103 F S II=$O(^TMP("DEP",LEV,II)) Q:'$L(II) D
104 .I '$$REQB(II,$P(^TMP("DEP",LEV,II),U)) K ^TMP("DEP",$J,LEV,II) Q
105 ;Now we have deleted all entries/packages already installed.. and set level + 1 depencencees...
106 S II=0,OK=1
107 F S II=$O(^TMP("DEP",$J,LEV,II)) Q:'$L(II) D
108 .Q:'$$GETDEP(II_",",LEV+1)
109 .S OK=0
110 Q OK
111GETDEP(IEN,LEV) ;
112 N TMP1,X1,DIC,Y,X
113 D GETS^DIQ(9.6,IEN,"11*",,"TMP1","ERR")
114 I $D(ERR) D Q
115 .W !,"Error in subfile # 9.611",!
116 S X1=0 F S X1=$O(TMP1(9.611,X1)) Q:'$L(X1) D
117 .S X=TMP1(9.611,X1,.01),DIC=9.6,DIC(0)="XZ" D ^DIC Q:Y=-1
118 .Q:'$$REQB(+Y,$G(TMP1(9.611,X1,.01)))
119 .S:'$D(^TMP("DEPX",$J,+Y)) ^TMP("DEP",$J,LEV,+Y)=TMP1(9.611,X1,.01)_U_TMP1(9.611,X1,1)
120 .S ^TMP("DEPX",$J,+Y,LEV)=""
121 Q $S($D(^TMP("DEP",$J,LEV)):1,1:0)
122REQB(IEN,XPDX) ;check for Required Builds
123 ;returns 0=ok, 1=failed kill global, 2=failed leave global
124 Q:'$L($G(XPDX)) 0
125 N XPDACT,XPDBLD,XPDI,XPDQ,XPDQUIT,XPDX0,X,Y,Z
126 S XPDQUIT=0,XPDI=0
127 S XPDQ=0,X=$$PKG^XPDUTL(XPDX),Y=$$VER^XPDUTL(XPDX),Z=$$VERSION^XPDUTL(X) D
128 .Q:Z>Y
129 .I XPDX'["*" S:Z<Y XPDQ=2
130 .E S:'$$PATCH^XPDUTL(XPDX) XPDQ=1
131 .;quit if patch is already on system
132 .Q:'XPDQ
133 .;quit if patch is sequenced prior within this build
134 .I $D(XPDT("NM",XPDX)),(XPDT("NM",XPDX)<XPDT("NM",XPDNM)) S XPDQ=0 Q
135 .S XPDQUIT=1
136 Q XPDQUIT
Note: See TracBrowser for help on using the repository browser.